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
It seems that strtol() under clang/asan doesn't set errno to ERANGE when the resulting value is out of range. I've ran into this on Windows with Msys2 build of llvm (clang64 toolchain).
The example further below, compiled via "clang -o t test.c" correctly prints:
Input: 12345689012
LONG_MAX=2147483647
Out of range
However, when compiled via " clang -o t test.c -fsanitize=address", it (incorrectly) prints:
It seems that strtol() under clang/asan doesn't set errno to ERANGE when the resulting value is out of range. I've ran into this on Windows with Msys2 build of llvm (clang64 toolchain).
The example further below, compiled via "clang -o t test.c" correctly prints:
However, when compiled via " clang -o t test.c -fsanitize=address", it (incorrectly) prints:
This is with clang version 19.1.6 on x86_64 and errno remains at value 0.
The example is:
The practice of setting errno to zero before calling strtol() and checking errno after the call follows POSIX recommendation.
The text was updated successfully, but these errors were encountered: