[Pkg-phototools-devel] Bug#785206: Invalid decompression

Mathieu Malaterre malat at debian.org
Wed May 13 13:07:49 UTC 2015


Package: libopenjp2-tools
Version: 2.1.0-2

I can generate an invalid file using kakadu 7.6:

wget -c http://www.ece.rice.edu/~wakin/images/lena512color.tiff
kdu_compress -i lena512color.tiff -o lena1024x1024.jp2
Sdims="{1024,1024}" Stiles="{512,512}" -frag 0,0,1,1 Creversible=yes
-no_info -quiet Clayers=5 Clevels=3
kdu_compress -i lena512color.tiff -o lena1024x1024.jp2
Sdims="{1024,1024}" Stiles="{512,512}" -frag 0,1,1,1 -rotate 180
Creversible=yes -no_info -quiet Clayers=6 Clevels=2
kdu_compress -i lena512color.tiff -o lena1024x1024.jp2
Sdims="{1024,1024}" Stiles="{512,512}" -frag 1,0,1,1 -rotate 180
Creversible=yes -no_info -quiet Clayers=7 Clevels=5
kdu_compress -i lena512color.tiff -o lena1024x1024.jp2
Sdims="{1024,1024}" Stiles="{512,512}" -frag 1,1,1,1 Creversible=yes
-no_info -quiet Clayers=8 Clevels=4

Which leads to:

$ opj_decompress -i lena1024x1024.jp2 -o bla.tif

[INFO] Start to read j2k main header (111).
[INFO] Main header has been correctly decoded.
[INFO] No decoded area parameters, set the decoded area to the whole image
[INFO] Header of tile 0 / 3 has been read.
[INFO] Tile 1/4 has been decoded.
[INFO] Image data has been updated with tile 1.

[INFO] Header of tile 1 / 3 has been read.
[INFO] Tile 2/4 has been decoded.
[INFO] Image data has been updated with tile 2.

[INFO] Header of tile 2 / 3 has been read.
[INFO] Tile 3/4 has been decoded.
[INFO] Image data has been updated with tile 3.

[INFO] Header of tile 3 / 3 has been read.
[INFO] Tile 4/4 has been decoded.
[INFO] Image data has been updated with tile 4.

[INFO] Stream reached its end !
[INFO] Generated Outfile bla.tif

However the file should have been detected as invalid:

$ kdu_expand -i lena1024x1024.jp2 -o bla.tif
Kakadu Core Error:
Illegal inclusion tag tree encountered while decoding a packet header.  This
problem can arise if empty packets are used (i.e., packets whose first header
bit is 0) and the value coded by the inclusion tag tree in a subsequent packet
is not exactly equal to the index of the quality layer in which each code-block
makes its first contribution.  Such an error may arise from a
mis-interpretation of the standard.  The problem may also occur as a result of
a corrupted code-stream.  Try re-opening the image with the resilient mode
enabled.



More information about the Pkg-phototools-devel mailing list