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

Prevent infinite loop in CFFParser_parseHeader #4473

Merged
merged 1 commit into from
Mar 17, 2014
Merged

Prevent infinite loop in CFFParser_parseHeader #4473

merged 1 commit into from
Mar 17, 2014

Conversation

Snuffleupagus
Copy link
Collaborator

if (offset !== 0) {
}
if (offset === bytesLength) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Throw an error, e.g. error('invalid cff header') . also change === to >=

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The reason that I didn't throw an error here, is that it prevents most of page 7 from loading. With the current patch, only one particular font will fail to load, but the rest of the page renders fine. The error is caught later in the code anyway, so throwing here seems suboptimal to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this. By returning undefined you just complicate things later, now you have failure at something like header.endPos which is less trivial than meaningful message. Not sure why that makes page 7 render.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't understand this either any more, since just throwing an error works perfectly now. I don't know what happened previously!

@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/9127e5ce977bfce/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/809a562f361d8c1/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/9127e5ce977bfce/output.txt

Total script time: 25.86 mins

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/809a562f361d8c1/output.txt

Total script time: 36.96 mins

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

yurydelendik added a commit that referenced this pull request Mar 17, 2014
Prevent infinite loop in CFFParser_parseHeader
@yurydelendik yurydelendik merged commit 59829bb into mozilla:master Mar 17, 2014
@yurydelendik
Copy link
Contributor

Thank you

@Snuffleupagus Snuffleupagus deleted the bug-866395-partial branch March 17, 2014 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants