fix(pvs): resolve Low Level (Level 3) static analyzer warnings and formatting notes - #88
Open
bivex wants to merge 4 commits into
Open
fix(pvs): resolve Low Level (Level 3) static analyzer warnings and formatting notes#88bivex wants to merge 4 commits into
bivex wants to merge 4 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
- Add array bounds guards for string operations in guided.c, msc_tcl.c, and structs.c - Fix sizeof(IArg_cont[IArgno]) target buffer in spinlex.c - Fix block scope formatting in spinlex.c - Declare alldone(int) with noreturn attribute and fix comparison logic in main.c - Guard NULL pointers in eligible() in pangen5.c - Clean up redundant pointer checks in flow.c and mesg.c - Remove redundant loop condition in pangen1.c - Add fallthrough annotations, simplify boolean logic, and remove dead assignment in pangen2.c - Remove unreachable code after fatal() in sym.c - Parenthesize assignment and ternary operator expression in tl_mem.c
…rmatting notes - Explicitly cast int/char arguments to match fprintf format specifiers in pangen2.c and pangen3.c - Add NULL pointer checks in claim_has_accept() in pangen7.c - Guard pointer dereferences in getlocal() and setlocal() in sched.c - Guard NULL pointers when building struct nodes in structs.c - Guard NULL pointers in dupnode() and isequal() in tl_cache.c - Cast memory size arguments to long for printf formatting in tl_cache.c and tl_main.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 Low Level (Level 3) static analyzer warnings and format specifier notes reported by PVS-Studio across the Spin codebase.
Fixes Included
Src/pangen2.c: Cast status expression to(int)forfprintfformatting.Src/pangen3.c: Cast node type to(char)forfprintf%cformat.Src/tl_cache.c&Src/tl_main.c: CastCaches,CacheHits, andAll_Memto(long)for%9ldformatting.Src/pangen7.c: Added NULL pointer check inclaim_has_accept().Src/sched.c: Guardedrpointer ingetlocal()andsetlocal().Src/structs.c: Guarded node allocations (cpnn) before field assignment.Src/tl_cache.c: Guardedgetnode()result indupnode()and node pointers inisequal().Verification
make clean && make) completed cleanly with 0 errors and 0 compiler warnings.