Skip to content

Fix Coverity static analysis issues#130

Merged
tjgreen42 merged 1 commit intomainfrom
fix-coverity-issues
Jan 10, 2026
Merged

Fix Coverity static analysis issues#130
tjgreen42 merged 1 commit intomainfrom
fix-coverity-issues

Conversation

@tjgreen42
Copy link
Copy Markdown
Collaborator

@tjgreen42 tjgreen42 commented Jan 10, 2026

Summary

Fix all 11 Coverity static analysis issues reported in the initial scan.

Issues Fixed

CID Severity File Issue Fix
640953, 640947 High merge.c Uninitialized dict_buf Initialize to InvalidBuffer
640951 Medium build.c NULL deref in tp_insert Add NULL check
640946 Medium am/scan.c Deref before NULL check Add early return
640955 Medium am/scan.c Deref after NULL check Add post-query NULL check
640949 Medium memtable/scan.c Deref after NULL check Add early return
640952 Medium segment/scan.c Deref before NULL check Add NULL check for reader
640954 Medium state.c Dead code Remove redundant NULL check
640957 Medium state.c Unexpected control flow Use flag instead of continue in PG_CATCH
640950 Medium merge.c Explicit NULL deref Add NULL check in allocation condition
640956 Medium segment.c Dead code Remove unreachable num_blocks check
640948 Medium merge.c Dead code Remove unreachable num_blocks check

Testing

  • All 35 SQL regression tests pass
  • All shell-based tests pass (concurrency, recovery, segment, stress)

@tjgreen42 tjgreen42 force-pushed the fix-coverity-issues branch from 7a1e917 to ce7fa1b Compare January 10, 2026 02:10
Address all 11 issues reported by Coverity scan:

High severity:
- merge.c: Initialize dict_buf to InvalidBuffer (CID 640953, 640947)

Medium severity:
- build.c: Add NULL check before tp_calculate_idf_sum (CID 640951)
- am/scan.c: Add early return if scan opaque is NULL (CID 640946)
- am/scan.c: Add NULL check after scoring query (CID 640955)
- memtable/scan.c: Add early return if scan opaque is NULL (CID 640949)
- segment/scan.c: Add NULL check for reader parameter (CID 640952)
- state.c: Remove redundant NULL check (CID 640954)
- state.c: Fix continue in PG_CATCH using flag pattern (CID 640957)
- merge.c: Add explicit NULL check in allocation condition (CID 640950)
- segment.c: Remove dead code in num_blocks calculation (CID 640956)
- merge.c: Remove dead code in num_blocks calculation (CID 640948)
@tjgreen42 tjgreen42 force-pushed the fix-coverity-issues branch from ce7fa1b to b3db29b Compare January 10, 2026 02:11
@tjgreen42 tjgreen42 merged commit d99c2ec into main Jan 10, 2026
12 checks passed
@tjgreen42 tjgreen42 deleted the fix-coverity-issues branch January 10, 2026 02:29
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.

1 participant