Jpx infinite loop for tiles with 0 Psot
See original GitHub issueJPEG2000 allows to set tile-part length to 0 in SOT segment (only the last part). This case is not handled in the code resulting in an infinite loop. End of data stream is marked by EOC in this case. As padding is possible, it must be found. Below possible solution:
tile.length = readUint32(data, position + 4);
if (tile.length === 0) {
for (var i = end - 2; i > position + length; i--) {
if (0xFFD9 === readUint16(data, i)) {
tile.dataEnd = i;
break;
}
}
if (tile.dataEnd === undefined) {
throw new Error('JPX Error: missing EOC');
}
} else {
tile.dataEnd = tile.length + position - 2;
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:8
Top Results From Across the Web
Version history — Bio-Formats 5.6.0 documentation
prevented a potential infinite loop when a scene with a pyramid is missing. cellSens VSI. a new option has been added to throw...
Read more >[gs-commits] ghostpdl annotated tag, ghostpdl-9.18rc1, created ...
Bug 692263 spot and elide glyphs with zero dimensions. Bug 689546: Add clist.dev to the ... Fix bug #692246 infinite loop searching the...
Read more >Detected Vulnerabilities and Situations in sgpkg-ips-1520-5242
This update package contains. Fingerprint signatures, 13439. Vulnerabilities, 8939. CVE/CAN entries, 7133. Applications, 7382.
Read more >Detailed History of Ghostscript versions 8.n - hdlbrokerdux.com.ar - /
The code now initialises the member of the structure to 0, which we then ... in a single string pdfwrite would enter an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@timvandermeij Sorry, but I think the right label would be
4-image-jpx
here.Also, the document in https://github.com/mozilla/pdf.js/issues/10793#issuecomment-490522099 doesn’t contain a single JPX image, actually it doesn’t even contain any
XObject
of any kind. Hence that comment is completely unrelated to this issue, and only serves to add confusion to the discussion. (It seems related to a custom implementation, since the file renders fine in the default viewer.)@timvandermeij Mind hiding/removing https://github.com/mozilla/pdf.js/issues/10793#issuecomment-490522099 and also this comment itself; thank you!
If you look closer, it’s just an ‘if’ statement for this special case, ‘else’ doesn’t change anything
I said j2k.
It’s closed by now. 👍