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 to recover when encountering JPEG markers with too short marker lengths (issue 8169) #8170

Merged
merged 1 commit into from
Mar 20, 2017
Merged

Conversation

Snuffleupagus
Copy link
Collaborator

The issue with the JPEG image in question, is that the COM (Comment) marker has an incorrect length entry.

Fixes #8169.

@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/37ab67f16a2e0c7/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/37ab67f16a2e0c7/output.txt

Total script time: 2.17 mins

Published

@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/4833c3b76d1fd0e/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/c65d67d38c81084/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

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

Total script time: 22.24 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/4833c3b76d1fd0e/output.txt

Total script time: 28.43 mins

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

src/core/jpg.js Outdated
// If the length of the previous block is incorrect (too short),
// treat the current "marker" as padding and skip past it when
// the next marker is a valid one (fixes issue8169.pdf).
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it was a "luck" that there is no other data in-between. We need to add a check to the readDataBlock and if there is no marker after the read block, throw a warning and seek a next marker starting from start of the read block.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point; is the updated patch better?
Note: I've not had time to run all tests locally yet, so if the approach is OK I'll trigger testing later.

…engths (issue 8169)

The issue with the JPEG image in question, is that the COM (Comment) marker has an incorrect length entry.

Fixes 8169.
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

@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/4cbe5e323b6b2db/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/dcf28ce3b689d02/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

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

Total script time: 22.45 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/4cbe5e323b6b2db/output.txt

Total script time: 30.13 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/47628de34e2a72a/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/ff5d443e665a1cf/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

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

Total script time: 21.67 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/47628de34e2a72a/output.txt

Total script time: 29.05 mins

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

@Snuffleupagus Snuffleupagus merged commit cfc45e5 into mozilla:master Mar 20, 2017
@Snuffleupagus Snuffleupagus deleted the issue-8169 branch March 20, 2017 19:36
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
Try to recover when encountering JPEG markers with too short marker lengths (issue 8169)
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.

3 participants