pdf.js/src/core
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
..
annotation.js Widget annotations: do not crash if Parent is not a dictionary 2017-03-09 23:51:52 +01:00
arithmetic_decoder.js Adds UMD headers to core, display and shared files. 2015-12-15 13:24:39 -06:00
bidi.js Fix inverted calculation of RTL text percentage in bidi. 2017-01-12 23:54:06 +08:00
cff_parser.js Handle cff fonts with erroneous stackSize 2017-03-06 19:28:46 -05:00
charsets.js Adds UMD headers to core, display and shared files. 2015-12-15 13:24:39 -06:00
chunked_stream.js Adjust the brace-style ESLint rule to disallow single lines (and also enable no-iterator) 2017-02-04 15:53:08 +01:00
cmap.js [api-minor] Refactor fetching of built-in CMaps to utilize a factory on the display side instead, to allow users of the API to provide a custom CMap loading factory (e.g. for use with Node.js) 2017-02-16 10:55:35 +01:00
colorspace.js Enable the no-else-return ESLint rule 2017-01-09 20:27:39 +01:00
crypto.js Enable the no-unused-vars ESLint rule 2017-01-29 23:23:17 +01:00
document.js Return undefined instead of Dict.empty from Page.getInheritedPageProp for non-existent properties to prevent possible future bugs 2017-03-04 13:08:39 +01:00
encodings.js Refactor Encodings 2016-01-28 11:32:59 -06:00
evaluator.js Adjust the yoda ESLint rule to apply to inequalities as well 2017-03-19 13:27:14 +01:00
font_renderer.js Enable the no-unused-vars ESLint rule 2017-01-29 23:23:17 +01:00
fonts.js Moves checkProblematicCharRanges to font_spec.js 2017-03-03 16:33:35 -06:00
function.js Enable the spaced-comment ESLint rule 2017-01-19 16:41:59 +01:00
glyphlist.js Add TeX-specific glyph names to glyphlist.js to improve both glyph mapping and text selection for mathematic fonts (issue 2594) 2016-10-26 16:39:58 +02:00
image.js Enable the no-else-return ESLint rule 2017-01-09 20:27:39 +01:00
jbig2.js Enable the no-unused-vars ESLint rule 2017-01-29 23:23:17 +01:00
jpg.js 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
jpx.js Adjust the yoda ESLint rule to apply to inequalities as well 2017-03-19 13:27:14 +01:00
metrics.js Lazify Metrics 2016-01-28 12:11:46 -06:00
murmurhash3.js Switch to using ESLint, instead of JSHint, for linting 2016-12-16 21:06:36 +01:00
network.js Network: use the current location to prevent errors when using CSP headers 2017-03-03 23:18:51 +01:00
obj.js Merge pull request #8112 from Snuffleupagus/JS-action-newWindow 2017-03-01 21:24:34 +01:00
parser.js Consume the current character when encountering illegal characters in Lexer.getObject, in order to prevent infinite loops during reading of streams (issue 8061) 2017-02-11 19:32:48 +01:00
pattern.js Adjust the yoda ESLint rule to apply to inequalities as well 2017-03-19 13:27:14 +01:00
pdf_manager.js Refactor the password handling so that it's stored in the PdfManagers, instead of in the XRef 2017-01-03 20:29:52 +01:00
primitives.js Move EOF/isEOF from core/parser.js to core/primitives.js 2017-01-27 13:37:48 +01:00
ps_parser.js Move EOF/isEOF from core/parser.js to core/primitives.js 2017-01-27 13:37:48 +01:00
standard_fonts.js Improve rendering of non-embedded NuptialScript font 2016-11-22 17:56:17 +01:00
stream.js Merge pull request #7972 from Snuffleupagus/eslint_no-unused-vars 2017-02-01 23:50:23 +01:00
type1_parser.js Font ascent descent calculation fix 2017-02-11 01:25:05 -05:00
unicode.js Enable the spaced-comment ESLint rule 2017-01-19 16:41:59 +01:00
worker.js Move compatibility code to the shared/compatibility.js. 2017-02-23 19:18:44 -06:00