-
Notifications
You must be signed in to change notification settings - Fork 468
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
There is an issue with rendering some type of jpeg file. Please ref the link. #672
Comments
pdfimages -jp2 possible-error-0004841_Crash_fxdecod1_RG_001_eMag.pdf . Syntax Warning: Found a misplaced 'cmap' box outside jp2h box<0a> j2k_to_image -i PDF-IMAGES-001.jp2 -o PDF-IMAGES-001.jp2-1.png [WARNING] SOT marker inconsistency in tile 0: tile-part index greater (5) than number of tile-parts (5) The resulting image is 77 x 186 large and completely black. opj_decompress -i PDF-IMAGES-001.jp2 -o PDF-IMAGES-001.jp2-2.png [WARNING] Found a misplaced 'cmap' box outside jp2h box [ERROR] Invalid component index 24400 (>= 1). |
Downloading on 2015-12-15 the current OPENJPEG from GITHUB: bin/opj_decompress -i PDF-IMAGES-001.jp2 -o PDF-IMAGES-001.jp2.png [WARNING] Found a misplaced 'cmap' box outside jp2h box [ERROR] Invalid component index 24400 (>= 1). After adding fprintf() into jp2.c, line 904 I get: [ERROR] Invalid component index 24400 (>= 1). My simple JP2_READER shows: FILE(PDF-IMAGES-001.jp2) read_jp2.c:1434: The CMAP box is outside the JP2H box. This file is buggy. winfried |
@henrygg , can you create a PDF page with a JP2 file that is not buggy? winfried |
The problem is these pdfs are provided to us by a 3rd party. Is there a way the code can handle (handle? fixup?) these bad CMAPs and continue without asserting and thereby aborting the whole process? |
At around line 887 of jp2.c file, in the following code. In the data structure of opj_jp2_pclr_t, what is the relationship between nr_channels and nr_entries? Does the "nr_entries" or "nr_channels" specify the count of entries contained in cmap?
|
@santoch , the library already tries to handle CMAP boxes outside the JP2H box. But if the respective values you should download the following file: Later files for 15444-1 can be bought ( search for '15444-1-2004'). Search for 'palette' and 'cmap'. winfried |
It seems the cmap entries are not validated when read from the buggy image. Also for this particular pdf(from https://bugs.chromium.org/p/pdfium/issues/detail?id=277), numcomps field in jp2 is 1, and the number of channels is 4, I am not sure whether the values are good or not. |
CMYK has 4 channels. The color shown by ADOBE or XPDF is blue only: one palette entry.
meth(1) prec(2) approx(1) enumcs[12]CMYK One can show this blue color if one only uses the color palette (PCLR) and ignores winfried |
This issue is easily reproducible with a debug build using afl-fuzz and a small test corpus. The Chromium project solved their issue by returning false instead of asserting (and exiting). Is there a benefit of asserting instead of handling the error condition cleanly? |
https://bugs.chromium.org/p/pdfium/issues/detail?id=277
The text was updated successfully, but these errors were encountered: