Skip to content

Commit

Permalink
Merge pull request #5729 from timvandermeij/ccitt-bytealign
Browse files Browse the repository at this point in the history
Fix CCITTStream regression by byte-aligning rows before checking EOL marker
  • Loading branch information
Snuffleupagus committed Feb 16, 2015
2 parents 8614c17 + 27e3558 commit 76a24d8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,10 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {

var gotEOL = false;

if (this.byteAlign) {
this.inputBits &= ~7;
}

if (!this.eoblock && this.row === this.rows - 1) {
this.eof = true;
} else {
Expand All @@ -2067,10 +2071,6 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
}
}

if (this.byteAlign && !gotEOL) {
this.inputBits &= ~7;
}

if (!this.eof && this.encoding > 0) {
this.nextLine2D = !this.lookBits(1);
this.eatBits(1);
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/issue5726.pdf.link
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
http://digipool.bib-bvb.de/bvb/info/OCR_with_TIFFG4.pdf
7 changes: 7 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,13 @@
"lastPage": 1,
"type": "eq"
},
{ "id": "issue5726",
"file": "pdfs/issue5726.pdf",
"md5": "f52f31ad3da316b599cade875ab049db",
"rounds": 1,
"link": true,
"type": "eq"
},
{ "id": "bug816075",
"file": "pdfs/bug816075.pdf",
"md5": "7ec87c115c1f9ec41234cc7002555e82",
Expand Down

0 comments on commit 76a24d8

Please sign in to comment.