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

Improve input validation in PDFDataTransportStream._onReceiveData (PR 15908 follow-up) #15917

Merged
merged 1 commit into from Jan 12, 2023

Conversation

Snuffleupagus
Copy link
Collaborator

The mozilla-central method PdfDataListener.readData can return null, hence it seems like a very good idea to update PDFDataTransportStream._onReceiveData to handle that gracefully since the current code will throw in that case.

Also, improves the JSDocs for the PDFDataRangeTransport class in the API.

@Snuffleupagus
Copy link
Collaborator Author

/botio unittest

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/2d277afc3db64f4/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://54.193.163.58:8877/1694dd66dc99daa/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/2d277afc3db64f4/output.txt

Total script time: 2.42 mins

  • Unit Tests: Passed

@calixteman
Copy link
Contributor

Does it require a new release in m-c ?

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/1694dd66dc99daa/output.txt

Total script time: 9.15 mins

  • Unit Tests: Passed

…PR 15908 follow-up)

The mozilla-central [method `PdfDataListener.readData`](https://searchfox.org/mozilla-central/rev/893a8f062ec6144c84403fbfb0a57234418b89cf/toolkit/components/pdfjs/content/PdfStreamConverter.jsm#207-210) can return `null`, hence it seems like a very good idea to update `PDFDataTransportStream._onReceiveData` to handle that gracefully since the current code will throw in that case.

Also, improves the JSDocs for the `PDFDataRangeTransport` class in the API.
@Snuffleupagus Snuffleupagus merged commit 1d68370 into mozilla:master Jan 12, 2023
@Snuffleupagus
Copy link
Collaborator Author

Does it require a new release in m-c ?

I don't really know, since I've not managed to trigger this with any real-world PDF document yet. (The patch was just based on code inspection.)
However, it's probably easier to land this now rather than having to uplift a patch later if breakage occurs. Especially since it seems to me that any breakage could very well be dependent on the exact timings involved.

@Snuffleupagus Snuffleupagus deleted the pr-15908-followup branch January 12, 2023 14:41
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.

None yet

3 participants