Skip to content

Fix (minor) UB due to signed overflow with unary minus#1

Open
maroneze wants to merge 1 commit intomirtoto:masterfrom
maroneze:master
Open

Fix (minor) UB due to signed overflow with unary minus#1
maroneze wants to merge 1 commit intomirtoto:masterfrom
maroneze:master

Conversation

@maroneze
Copy link
Copy Markdown

@maroneze maroneze commented Sep 5, 2025

The minus operator was applied to a long long variable before casting to unsigned, so technically there was an UB (in the words of undefined behavior sanitizer, "negation of LLONG_MIN cannot be represented in type 'long long'").

Frama-C/Eva showed it thanks to the test test_long_long_dec_min.

The minus operator was applied to a long long variable _before_ casting to
unsigned, so technically there was an UB (in the words of undefined behavior
sanitizer, "negation of LLONG_MIN cannot be represented in type 'long long'").
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