ilyakurdyukov / jpeg-quantsmooth

JPEG artifacts removal based on quantization coefficients.
GNU Lesser General Public License v2.1
245 stars 21 forks source link

New issue about FPB #25

Closed Cvjark closed 2 years ago

Cvjark commented 2 years ago

sample file

id0_FPE_jpegqs+0x41c889.zip

command to reproduce

./jpegqs -o [sample file] /dev/null

crash detail

AddressSanitizerAddressSanitizerAddressSanitizerAddressSanitizer:DEADLYSIGNAL
:DEADLYSIGNAL
:DEADLYSIGNAL
:DEADLYSIGNAL
=================================================================
AddressSanitizer:DEADLYSIGNAL
==28436==ERROR: AddressSanitizer: FPE on unknown address 0x0000004f5d6c (pc 0x0000004f5d6c bp 0x7ffc2659eef0 sp 0x7ffc2659e2c0 T0)
AddressSanitizer:DEADLYSIGNAL
    #0 0x4f5d6c  (/home/bupt/Desktop/jpeg-quantsmooth/jpegqs+0x4f5d6c)
    #1 0x7fbb4a1b3452 in __kmp_invoke_microtask (/usr/lib/x86_64-linux-gnu/libomp.so.5+0x7c452)
    #2 0x7fbb4a16d1b6  (/usr/lib/x86_64-linux-gnu/libomp.so.5+0x361b6)
    #3 0x7fbb4a16e2b5 in __kmp_fork_call (/usr/lib/x86_64-linux-gnu/libomp.so.5+0x372b5)
    #4 0x7fbb4a1617be in __kmpc_fork_call (/usr/lib/x86_64-linux-gnu/libomp.so.5+0x2a7be)
    #5 0x4ea485  (/home/bupt/Desktop/jpeg-quantsmooth/jpegqs+0x4ea485)
    #6 0x7fbb49b4fc86 in __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:310
    #7 0x41c889 in _init (/home/bupt/Desktop/jpeg-quantsmooth/jpegqs+0x41c889)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: FPE (/home/bupt/Desktop/jpeg-quantsmooth/jpegqs+0x4f5d6c) 
==28436==ABORTING
ilyakurdyukov commented 2 years ago

This is a divide-by-zero exception because this image is damaged and the quantization table contains zeros:

quant[0]:
0001 0001 0001 0001 0001 0001 0001 0001 
0001 0001 0001 0001 0001 0001 0001 0001 
0001 0001 0001 0001 0001 0001 0001 00ff 
0001 0001 0001 0001 0001 0001 00d8 0000 
0001 0001 0001 0001 0001 00ff 0046 0001 
0001 0001 0001 0001 00e0 0049 0001 0060 
0001 0001 0001 0000 0046 0001 0000 0000 
0001 0001 0010 004a 0000 0060 0000 00ff 

Fixed in the latest commit. Thanks for reporting.