Skip to content

Fix unsigned int overflow reported by UBSan#761

Merged
mayeut merged 2 commits intouclouvain:masterfrom
mayeut:uint-overflow
Apr 28, 2016
Merged

Fix unsigned int overflow reported by UBSan#761
mayeut merged 2 commits intouclouvain:masterfrom
mayeut:uint-overflow

Conversation

@mayeut
Copy link
Copy Markdown
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
Copy Markdown
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.

3 participants