You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@xmoezzz: I cannot reproduce this problem with the latest commit of JasPer on the master branch. When I run the jasper program (built with ASan and UBSan enabled) with the command line that you specified, I get the following output:
warning: ignoring bogus command line argument
warning: ignoring bogus command line argument
invalid PGX signature
cannot get header
jas_image_decode: decode operation failed
error: cannot load image data
Did you try the latest commit on the master branch?
@xmoezzz Unsigned integer overflow is not UB. It is well defined with wraparound semantics. Also, this code behaves correctly when overflow/wraparound occurs. So, there is really no bug here. In any case, I have rewritten the loop to avoid any possible wraparound. This should get rid of your sanitizer warning, which is a false positive in this case.
@jubalh Please note that this change did not fix any real problem. There was not any security vulnerability (or even bug). Unsigned integer overflow is not UB in C and the code worked correctly in the presence of overflow. I only made this change for the benefit of people who might turn on UBSan and get annoyed by benign warnings.
Activity
mdadams commentedon Nov 13, 2025
@xmoezzz: I cannot reproduce this problem with the latest commit of JasPer on the master branch. When I run the jasper program (built with ASan and UBSan enabled) with the command line that you specified, I get the following output:
Did you try the latest commit on the master branch?
xmoezzz commentedon Nov 17, 2025
Thanks for your reply!
I tried the latest commit of the master branch (7576bf0).
This is my build command:
CC=clang CXX=clang++ \ cmake -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_C_FLAGS="-fsanitize=address -fno-omit-frame-pointer -fsanitize=signed-integer-overflow -fsanitize=unsigned-integer-overflow -fsanitize=shift -fsanitize=bounds -fsanitize=null -fsanitize=pointer-overflow -g -O1" \ -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined" \ -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=address,undefined" \ ../jaspermdadams commentedon Jan 12, 2026
@xmoezzz Unsigned integer overflow is not UB. It is well defined with wraparound semantics. Also, this code behaves correctly when overflow/wraparound occurs. So, there is really no bug here. In any case, I have rewritten the loop to avoid any possible wraparound. This should get rid of your sanitizer warning, which is a false positive in this case.
Fixes jasper-software#407.
jubalh commentedon Mar 5, 2026
I think this issue/change was not mentioned in the NEWS document and thus not in 4.2.9 release.
mdadams commentedon Mar 5, 2026
@jubalh Please note that this change did not fix any real problem. There was not any security vulnerability (or even bug). Unsigned integer overflow is not UB in C and the code worked correctly in the presence of overflow. I only made this change for the benefit of people who might turn on UBSan and get annoyed by benign warnings.
jubalh commentedon Mar 5, 2026
I see. Thank you for clarifying :)