fix(pvs): resolve all High Level (Level 1) static analyzer warnings - #86
Open
bivex wants to merge 2 commits into
Open
fix(pvs): resolve all High Level (Level 1) static analyzer warnings#86bivex wants to merge 2 commits into
bivex wants to merge 2 commits into
Conversation
- Fix potential buffer overflow and bounds check in main.c (preprocess) - Fix termios c_lflag bitmask truncation on 64-bit platforms in mesg.c - Fix potential null pointer dereferences in pangen2.c, pangen3.c, and run.c - Fix undefined behavior in 64-bit bit shift operations (1UL<<j) in pangen6.c - Fix EVAL AST node child type check logic in pangen6.c - Fix code formatting ambiguity in pangen7.c - Fix potential division by zero modulo in run.c
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
This PR resolves all High Level (Level 1) static analyzer warnings reported by PVS-Studio in the Spin C codebase.
Fixes Included
.gitignore: Added ignores for PVS-Studio log/report files andcompile_commands.json.Src/main.c: Fixed buffer overflow bounds check duringPreArgconcatenation inpreprocess()and removed impossible post-hocstrlencheck.Src/mesg.c: Added(tcflag_t)casts to~ICANON,~ECHO, and~ISIGinpeek_ch_init()to prevent 64-bit mask truncation.Src/pangen2.c&Src/pangen3.c: Added null guards fornow->lftbefore dereferencingsym.Src/pangen3.c: Removed redundantif (now->ntyp == PRINT)insidecase PRINT:.Src/pangen6.c: Fixed AST node child type check logic forEVALcases (v->lft->lft->ntyp == ',') and updated 32-bit integer shifts (1 << j) to 64-bit unsigned long shifts (1UL << j) in bitmask operations.Src/pangen7.c: Cleaned upelse ifformatting to remove ambiguity.Src/run.c: Added zero guard for modulo operation (Rand() % j) and null guard fore->subincase UNLESS:.Verification
make clean && make) completed with zero errors.