Skip to content

fix: disable unsigned integer overflow sanitization#4785

Merged
lum1n0us merged 5 commits intobytecodealliance:mainfrom
lum1n0us:fix/disable_unsigned_int_overflow
Jan 22, 2026
Merged

fix: disable unsigned integer overflow sanitization#4785
lum1n0us merged 5 commits intobytecodealliance:mainfrom
lum1n0us:fix/disable_unsigned_int_overflow

Conversation

@lum1n0us
Copy link
Contributor

@lum1n0us lum1n0us commented Jan 14, 2026

@lum1n0us lum1n0us force-pushed the fix/disable_unsigned_int_overflow branch 2 times, most recently from 2553a38 to 7d73ab6 Compare January 14, 2026 12:54
…ations

FYI: from https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html

`-fsanitize=unsigned-integer-overflow`: Unsigned integer overflow, where the result of an unsigned integer computation cannot be represented in its type. Unlike signed integer overflow, this is not undefined behavior, but it is often unintentional. This sanitizer does not check for lossy implicit conversions performed before such a computation.

It brings a more common question: which is better, pre-additional-check or post-additional-check to fix a potential unsigned integer overflow? A pre-additional-check involves using a check to prevent integer overflow from the very beginning. A post-additional-check involves using a check after addition to see if there is an overflow.

In this project, post-additional-checking is widely used. let's follow the routine.

for performance sensitive logic, use __builtin_add_overflow etc. provide something like https://github.com/yamt/toywasm/blob/9a5622791e99395e26e6e96cef830af3d91a1685/lib/platform.h#L176-L191 and encourage the use of them.

ref. bytecodealliance#4549 (comment)
@lum1n0us lum1n0us force-pushed the fix/disable_unsigned_int_overflow branch from 7d73ab6 to b94a92f Compare January 16, 2026 02:28
@lum1n0us lum1n0us marked this pull request as ready for review January 19, 2026 02:57
@lum1n0us lum1n0us merged commit 520410d into bytecodealliance:main Jan 22, 2026
558 of 563 checks passed
@lum1n0us lum1n0us deleted the fix/disable_unsigned_int_overflow branch January 22, 2026 13:40
@lum1n0us lum1n0us added the enhancement Check if this issue/PR enhances a feature; scripts will use this info. label Jan 22, 2026
@lum1n0us
Copy link
Contributor Author

Static PGO has been verified with version 18.1.8 and has passed.

@lum1n0us lum1n0us added the bug-fix Determine if this PR addresses a bug. It will be used by scripts to classify PRs. label Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix Determine if this PR addresses a bug. It will be used by scripts to classify PRs. enhancement Check if this issue/PR enhances a feature; scripts will use this info.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants