Replace assert() with proper error handling for user-triggerable conditions#2535
Open
sirus20x6 wants to merge 1 commit intosamtools:developfrom
Open
Replace assert() with proper error handling for user-triggerable conditions#2535sirus20x6 wants to merge 1 commit intosamtools:developfrom
sirus20x6 wants to merge 1 commit intosamtools:developfrom
Conversation
…itions
assert() is compiled out in release builds (NDEBUG), causing silent
undefined behavior or buffer overflows when triggered by malformed input.
- consensus.c: Replace asserts on variant overlap trimming, unreachable
overlap case, and fasta buffer bounds with error() calls
- convert.c: Replace GT type asserts with warning+skip; add allele index
bounds checks in process_tgt and process_iupac_gt
- vcfconcat.c: Replace bgzf block size assert with error() call
- filter.c: Add NULL check for getenv("HOME") and getenv("HOMEDRIVE")/
getenv("HOMEPATH") in expand_path()
929c0d9 to
7178ca4
Compare
This file contains hidden or 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
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.
Summary
Several
assert()calls guard conditions that can be triggered by user input. In release builds with NDEBUG, these are compiled out, causing silent undefined behavior or buffer overflows.error()callsline->d.allele[ial]accesserror()callgetenv("HOME")before passing tokputsTest plan