A malloc size error in tiff2pdf.c:2277:5
System info
Ubuntu X64, gcc (Ubuntu 5.5.0-12ubuntu1), tiff2pdf (libtiff latest master 1373f8da)
Configure
CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address" ./configure
Command line
./tools/tiff2pdf -F -i -j -o /dev/null @@
AddressSanitizer output
==38390==WARNING: AddressSanitizer failed to allocate 0xffd003ffcfff5000 bytes
==38390==AddressSanitizer's allocator is terminating the process instead of returning 0
==38390==If you don't like this behavior set allocator_may_return_null=1
==38390==AddressSanitizer CHECK failed: /build/llvm-toolchain-6.0-QjOn7h/llvm-toolchain-6.0-6.0/projects/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc:225 "((0)) != (0)" (0x0, 0x0)
#0 0x4e43b5 in __asan::AsanCheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/home/seviezhou/libtiff/tools/tiff2pdf+0x4e43b5)
#1 0x501c65 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) (/home/seviezhou/libtiff/tools/tiff2pdf+0x501c65)
#2 0x4ea7a6 in __sanitizer::ReportAllocatorCannotReturnNull() (/home/seviezhou/libtiff/tools/tiff2pdf+0x4ea7a6)
#3 0x4ea7e6 in __sanitizer::ReturnNullOrDieOnFailure::OnBadRequest() (/home/seviezhou/libtiff/tools/tiff2pdf+0x4ea7e6)
#4 0x426366 in __asan::asan_malloc(unsigned long, __sanitizer::BufferedStackTrace*) (/home/seviezhou/libtiff/tools/tiff2pdf+0x426366)
#5 0x4db23b in __interceptor_malloc (/home/seviezhou/libtiff/tools/tiff2pdf+0x4db23b)
#6 0x69e234 in _TIFFmalloc /home/seviezhou/libtiff/libtiff/tif_unix.c:314:10
#7 0x52f6f0 in t2p_readwrite_pdf_image /home/seviezhou/libtiff/tools/tiff2pdf.c:2277:5
#8 0x519ce5 in t2p_write_pdf /home/seviezhou/libtiff/tools/tiff2pdf.c:5709:15
#9 0x514f2d in main /home/seviezhou/libtiff/tools/tiff2pdf.c:827:2
#10 0x7f72f832db96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
#11 0x41b3a9 in _start (/home/seviezhou/libtiff/tools/tiff2pdf+0x41b3a9)
POC
malloc-size-error-t2p_readwrite_pdf_image_tile-tiff2pdf-2277.zip
Edited by azhou