1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00
pdf.js/src
Jonas Jenwald d6d0f778aa Don't read past the EOI marker for JPEG images with non-default restart interval (issue 7828)
*After browsing through (a version of) the JPEG specification, see https://www.w3.org/Graphics/JPEG/itu-t81.pdf, I hope that this patch makes sense.*

Note that while issue 7828 became a problem after PR 7661, it isn't really a regression from than PR. The explanation is rather that we're now relying on `core/jpg.js` instead of the Native Image decoder in more situations than before, which thus exposed an *existing* issue in our JPEG decoder.
Another factor also seems to be that in many JPEG images, the DRI (Define Restart Interval) marker isn't present, in which case this bug won't manifest either.

According to https://www.w3.org/Graphics/JPEG/itu-t81.pdf#page=89 (at the bottom of the page):
"NOTE – The final restart interval may be smaller than the size specified by the DRI marker segment, as it includes only the number of MCUs remaining in the scan."
Furthermore, according to https://www.w3.org/Graphics/JPEG/itu-t81.pdf#page=39 (in the middle of the page):
"[...] If restart is enabled and the restart interval is defined to be Ri, each entropy-coded segment except the last one shall contain Ri MCUs. The last one shall contain whatever number of MCUs completes the scan."

Based on the above, it thus seem to me that we should simply ensure that we're not attempting to continue to parse Scan data once we've found all MCUs (Minimum Coded Unit) of the image.

Fixes 7828.
2017-03-20 17:16:33 +01:00
..
core Don't read past the EOI marker for JPEG images with non-default restart interval (issue 7828) 2017-03-20 17:16:33 +01:00
display Normalize the BBox entry in Tiling Pattern dictionaries (issue 8117) 2017-03-16 21:43:11 +01:00
images Vectorize the logo. 2012-10-29 14:08:52 -04:00
shared Adjust the yoda ESLint rule to apply to inequalities as well 2017-03-19 13:27:14 +01:00
doc_helper.js Switch to using ESLint, instead of JSHint, for linting 2016-12-16 21:06:36 +01:00
license_header.js Replace copyright headers; changes UMD to CommonJS. 2017-02-08 16:35:58 -06:00
main_loader.js Append the contents of FileAttachment annotations to the attachments view of the sidebar, for easier access to the embedded files 2017-01-31 22:26:16 +01:00
pdf.js Fixes pdf.combined.js for webpack. 2017-02-10 11:24:35 -06:00
pdf.worker.entry.js Switch to using ESLint, instead of JSHint, for linting 2016-12-16 21:06:36 +01:00
pdf.worker.js Replacing custom bundling with webpack2. 2017-02-08 16:32:15 -06:00
worker_loader.js Replaces RequireJS to SystemJS. 2017-02-27 08:32:39 -06:00