Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unsigned int overflow reported by UBSan #761

Merged
merged 2 commits into from
Apr 28, 2016

Conversation

mayeut
Copy link
Collaborator

@mayeut mayeut commented Apr 28, 2016

Please add -DOPJ_UBSAN_BUILD to CFLAGS when building with
-fsanitize=undefined,unsigned-integer-overflow

It seems clang/gcc do not allow to disable checking for block of code
other than function or file.

Update #718

Please add -DOPJ_UBSAN_BUILD to CFLAGS when building with
-fsanitize=undefined,unsigned-integer-overflow

It seems clang/gcc do not allow to disable checking for block of code
other than function or file.
@mayeut mayeut merged commit 29313eb into uclouvain:master Apr 28, 2016
@mayeut mayeut deleted the uint-overflow branch April 29, 2016 21:23
@julienmalik
Copy link
Collaborator

I missed this.

Now the nightly dashboard submission from dora.c-s.fr for ubsan will include this -DOPJ_UBSAN_BUILD (both gcc and clang).
This removes 2 ubsan reports for the clang build.

Though I'm not sure to understand why we end up in the assert while the file should be rejected (should openpeg fail earlier ?).

Also I don't understand the your comment "It seems clang/gcc do not allow to disable checking for block of code other than function or file." : opj_bio_read/write get inlined so the OPJ_NOSANITIZE() does not work ?

rouault added a commit to rouault/openjpeg that referenced this pull request Jun 17, 2017
…n#761)

Commit 29313eb introduced those flags to avoid issues with
-fsanitize=unsigned-integer-overflow
However it is better just to rewrite the loop to avoid such condition
to occur.
rouault added a commit that referenced this pull request Jun 17, 2017
Remove OPJ_NOSANITIZE in opj_bio_read() and opj_bio_write() (#761)
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.

None yet

3 participants