Skip to content

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant