-
Notifications
You must be signed in to change notification settings - Fork 442
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
Add undefined behaviour sanitizer into the CI checks #1816
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
daviesrob
reviewed
Aug 12, 2024
We already have address sanitizer, so add "undefined" into the mix. We also have to tweak a few warnings when using ubsan.
Useful when diagnosing CI systems.
We lost level 2 when we swapped the sanitizers between ubuntu gcc and clang, as Clang's -Wformat=2 is too spammy and we couldn't keep it on gcc as it breaks the sanitizers. So this puts it onto a third build instead.
These are needed in newer clangs with -Wformat=2.
daviesrob
added a commit
to daviesrob/bcftools
that referenced
this pull request
Aug 19, 2024
Companion to samtools/htslib#1816, which among other things adds printf format checking attributes to bcf_hdr_printf(). This fixes a few places that could trigger warnings in bcftools as a result of that change. It also adds checking for some functions internal to bcftools so `clang -Wformat -Wformat=2` works and fixes a couple of bugs that were found as a result. The -Wformat=2 option disallows non-literals in printf-like functions, which can be a little difficult to work around. Here most cases were fairly easy to sort out, apart from hdr_append() in plugins/fill-tags.c. For that the chosen solution was to convert the function into a macro. While not particularly nice it does allow all of the format strings passed in to be validated properly. Adds Wformat to clang CI build to catch any future regressions.
daviesrob
added a commit
to daviesrob/bcftools
that referenced
this pull request
Aug 19, 2024
Companion to samtools/htslib#1816, which among other things adds printf format checking attributes to bcf_hdr_printf(). This fixes a few places that could trigger warnings in bcftools as a result of that change. It also adds checking for some functions internal to bcftools so `clang -Wformat -Wformat=2` works and fixes a couple of bugs that were found as a result. The -Wformat=2 option disallows non-literals in printf-like functions, which can be a little difficult to work around. Here most cases were fairly easy to sort out, apart from hdr_append() in plugins/fill-tags.c. For that the chosen solution was to convert the function into a macro. While not particularly nice it does allow all of the format strings passed in to be validated properly. Adds Wformat to clang CI build to catch any future regressions.
daviesrob
added a commit
to daviesrob/bcftools
that referenced
this pull request
Aug 19, 2024
Companion to samtools/htslib#1816, which among other things adds printf format checking attributes to bcf_hdr_printf(). This fixes a few places that could trigger warnings in bcftools as a result of that change. It also adds checking for some functions internal to bcftools so `clang -Wformat -Wformat=2` works and fixes a couple of bugs that were found as a result. Bugs fixed: * In open_file() a user-controlled string was passed as the format to mkdir_p(), which could lead to information leakage or possibly arbitrary writes via a crafted file path name. * Use of wrong type for position in vcfsort sort_blocks() error report. * Printing the wrong variable in vcfsort do_partial_merge() error report. The -Wformat=2 option disallows non-literals in printf-like functions, which can be a little difficult to work around. Here most cases were fairly easy to sort out, apart from hdr_append() in plugins/fill-tags.c. For that the chosen solution was to convert the function into a macro. While not particularly nice it does allow all of the format strings passed in to be validated properly. Adds Wformat to clang CI build to catch any future regressions.
pd3
pushed a commit
to samtools/bcftools
that referenced
this pull request
Sep 6, 2024
Companion to samtools/htslib#1816, which among other things adds printf format checking attributes to bcf_hdr_printf(). This fixes a few places that could trigger warnings in bcftools as a result of that change. It also adds checking for some functions internal to bcftools so `clang -Wformat -Wformat=2` works and fixes a couple of bugs that were found as a result. Bugs fixed: * In open_file() a user-controlled string was passed as the format to mkdir_p(), which could lead to information leakage or possibly arbitrary writes via a crafted file path name. * Use of wrong type for position in vcfsort sort_blocks() error report. * Printing the wrong variable in vcfsort do_partial_merge() error report. The -Wformat=2 option disallows non-literals in printf-like functions, which can be a little difficult to work around. Here most cases were fairly easy to sort out, apart from hdr_append() in plugins/fill-tags.c. For that the chosen solution was to convert the function into a macro. While not particularly nice it does allow all of the format strings passed in to be validated properly. Adds Wformat to clang CI build to catch any future regressions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Due to cirrus-ci lacking ubsan in the clang installation it needed a bit of juggling as to what checks are executed in which compiler, but this now allows us to automatically spot some undefined behaviour via the CI system.