Assertion failed in OJPEGPostDecode() tif_ojpeg.c:907
Summary
Assertion failed in OJPEGPostDecode() tif_ojpeg.c:907
Version
LIBTIFF, Version 4.3.0
Copyright (c) 1988-1996 Sam Leffler
Copyright (c) 1991-1996 Silicon Graphics, Inc.
Steps to reproduce
git clone git@gitlab.com:libtiff/libtiff.git
cd libtiff/
./autogen.sh
export CFLAGS="-g -O0 -fsanitize=address"
export CXXFLAGS="-g -O0 -fsanitize=address"
CC=/usr/local/bin/afl-gcc CXX=/usr/local/bin/afl-g++ ../configure
make
make install
afl-fuzz -d -m none -i ./images -o ./out ../tiff2ps @@ /dev/null
../tiff2ps ./poc
Platform
$ gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ uname -r
4.15.0-154-generic
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
ASAN
$ ../tiff2ps ./poc
TIFFReadDirectoryCheckOrder: Warning, Invalid TIFF directory; tags are not sorted in ascending order.
TIFFReadDirectory: Warning, Unknown field with tag 65535 (0xffff) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 0 (0x0) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 63375 (0xf78f) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 40772 (0x9f44) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 16 (0x10) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 12833 (0x3221) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 32 (0x20) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 46774 (0xb6b6) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 680 (0x2a8) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 30722 (0x7802) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 769 (0x301) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 1025 (0x401) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 1281 (0x501) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 28527 (0x6f6f) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 30583 (0x7777) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 595 (0x253) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 386 (0x182) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 3 (0x3) encountered.
TIFFFetchNormalTag: Warning, Incorrect count for "FillOrder"; tag ignored.
TIFFFetchNormalTag: Warning, Incompatible type for "DocumentName"; tag ignored.
TIFFFetchNormalTag: Warning, Incorrect count for "XResolution"; tag ignored.
TIFFFetchNormalTag: Warning, IO error during reading of "YResolution"; tag ignored.
TIFFFetchNormalTag: Warning, Incorrect count for "JpegInterchangeFormat"; tag ignored.
TIFFFetchNormalTag: Warning, IO error during reading of "Tag 3"; tag ignored.
TIFFReadDirectory: Warning, BitsPerSample tag is missing, assuming 8 bits per sample.
TIFFReadDirectory: Warning, Sum of Photometric type-related color channels and ExtraSamples doesn't match SamplesPerPixel. Defining non-color channels as ExtraSample
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: tiff2ps
%%Title: id:000014,sig:06,src:011759,op:havoc,rep:2
%%CreationDate: Mon Dec 13 13:44:39 2021
%%DocumentData: Clean7Bit
%%Origin: 0 0
%%BoundingBox: 0 0 7 2
%%LanguageLevel: 1
%%Pages: 1 1
%%EndComments
%%Page: 1 1
gsave
100 dict begin
7.000000 2.000000 scale
/bwproc {
rgbproc
dup length 3 idiv string 0 3 0
5 -1 roll {
add 2 1 roll 1 sub dup 0 eq {
pop 3 idiv
3 -1 roll
dup 4 -1 roll
dup 3 1 roll
5 -1 roll put
1 add 3 0
} { 2 1 roll } ifelse
} forall
pop pop pop
} def
/colorimage where {pop} {
/colorimage {pop pop /rgbproc exch def {bwproc} image} bind def
} ifelse
%ImageData: 7 2 8 3 0 1 2 "false 3 colorimage"
/line 21 string def
7 2 8
[7 0 0 -2 0 2]
{currentfile line readhexstring pop} bind
false 3 colorimage
OJPEGSetupDecode: Warning, Deprecated and troublesome old-style JPEG compression mode, please convert to new-style JPEG compression and notify vendor of writing soft
LibJpeg: Warning, Corrupt JPEG data: bad Huffman code.
tiff2ps: tif_ojpeg.c:907: OJPEGPostDecode: Assertion `sp->libjpeg_session_active!=0' failed.
[1] 16481 abort ../tiff2ps ./poc
poc: poc.zip Thanks!