Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try harder to find the next valid JPEG marker when decoding Scan data (issue 8182, issue 8189) #8190

Merged
merged 1 commit into from
Mar 27, 2017

Conversation

Snuffleupagus
Copy link
Collaborator

Tentatively fixes #8182 and fixes #8189.

@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.21.233.14:8877/f457c2d562dd976/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/f457c2d562dd976/output.txt

Total script time: 29.32 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@Snuffleupagus
Copy link
Collaborator Author

/botio-windows test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.215.176.217:8877/5facc8340bbd646/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/5facc8340bbd646/output.txt

Total script time: 22.83 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

Copy link
Contributor

@yurydelendik yurydelendik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with comments addressed.

src/core/jpg.js Outdated
}
}
return {
invalid: currentMarker.toString('16'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: fix toString arg type .toString(16)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed now.

src/core/jpg.js Outdated
var newMarker = peekUint16(newPos);
while (!(newMarker >= 0xFFC0 && newMarker <= 0xFFFE)) {
newMarker = peekUint16(++newPos);
if (newPos >= maxPos) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increment newPos and move this if before peekUint16() call

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, it's done.

@@ -594,6 +605,39 @@ var JpegImage = (function JpegImageClosure() {
return a <= 0 ? 0 : a >= 255 ? 255 : a;
}

function findNextFileMarker(data, currentPos, startPos) {
function peekUint16(pos) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use readUint16 instead?

Copy link
Collaborator Author

@Snuffleupagus Snuffleupagus Mar 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As agreed on IRC, since there already is such a function (see

function readUint16() {
), I'm leaving it as-is.

… (issue 8182, issue 8189)

Tentatively fixes 8182 and fixes 8189.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.21.233.14:8877/c7c80185fe3ef0f/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.215.176.217:8877/e393cc08072fb15/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/e393cc08072fb15/output.txt

Total script time: 23.11 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/c7c80185fe3ef0f/output.txt

Total script time: 29.05 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@Snuffleupagus
Copy link
Collaborator Author

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_makeref from @Snuffleupagus received. Current queue size: 0

Live output at: http://107.21.233.14:8877/2db836b3910d485/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_makeref from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.215.176.217:8877/8532b7c299aaaa8/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/8532b7c299aaaa8/output.txt

Total script time: 22.61 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/2db836b3910d485/output.txt

Total script time: 28.52 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@Snuffleupagus Snuffleupagus merged commit ede4d3c into mozilla:master Mar 27, 2017
@Snuffleupagus Snuffleupagus deleted the issue-8182 branch March 27, 2017 15:23
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
Try harder to find the next valid JPEG marker when decoding Scan data (issue 8182, issue 8189)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: JPEG error: marker was not found. Scanned from Samsung MFP. PDF with blank pages
3 participants