1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Removes AES padding

This commit is contained in:
Yury Delendik 2013-06-22 20:22:01 -05:00
parent 23ea9d879d
commit c099d6ba94
2 changed files with 29 additions and 12 deletions

View file

@ -1056,6 +1056,8 @@ var DecryptStream = (function DecryptStreamClosure() {
this.str = str;
this.dict = str.dict;
this.decrypt = decrypt;
this.nextChunk = null;
this.initialized = false;
DecodeStream.call(this);
}
@ -1065,13 +1067,22 @@ var DecryptStream = (function DecryptStreamClosure() {
DecryptStream.prototype = Object.create(DecodeStream.prototype);
DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
var chunk = this.str.getBytes(chunkSize);
var chunk;
if (this.initialized) {
chunk = this.nextChunk;
} else {
chunk = this.str.getBytes(chunkSize);
this.initialized = true;
}
if (!chunk || chunk.length === 0) {
this.eof = true;
return;
}
this.nextChunk = this.str.getBytes(chunkSize);
var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
var decrypt = this.decrypt;
chunk = decrypt(chunk);
chunk = decrypt(chunk, !hasMoreData);
var bufferLength = this.bufferLength;
var i, n = chunk.length;