libpcp: reject undersized metadata records in __pmLogLoadMeta - #2663
libpcp: reject undersized metadata records in __pmLogLoadMeta#2663kurik wants to merge 2 commits into
Conversation
__pmLogLoadMeta() rejects undersized metadata records qa/2009: exercise __pmLogLoadMeta undersized metadata record rejection Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughBoth metadata loaders now validate record sizes and payload structure. QA test 2009 creates malformed archives and verifies that ChangesMetadata validation
Sequence Diagram(s)sequenceDiagram
participant pmdumplog
participant __pmLogLoadMeta
participant metadata_archive
pmdumplog->>__pmLogLoadMeta: load metadata records
__pmLogLoadMeta->>metadata_archive: read crafted record header and body
metadata_archive-->>__pmLogLoadMeta: undersized or malformed payload
__pmLogLoadMeta-->>pmdumplog: return PM_ERR_LOGREC and report Corrupted record
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1⚔️ Resolve merge conflicts 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/libpcp/src/logmeta.c`:
- Around line 821-827: Enforce remaining-length bounds before every metadata
field and string read in the loaders’ record-parsing paths, including the checks
around the rlen validation in src/libpcp/src/logmeta.c (lines 821-827) and
src/libpcp3/src/logmeta.c (lines 767-773), rejecting zero or undersized positive
payloads without crossing record or allocation boundaries. Extend qa/2009 (lines
63-75) with total lengths 12 through 19 to cover these cases.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 8a9f0fa1-1045-44b5-921d-664eb5655ea9
⛔ Files ignored due to path filters (1)
qa/2009.outis excluded by!**/*.out
📒 Files selected for processing (4)
qa/2009qa/groupsrc/libpcp/src/logmeta.csrc/libpcp3/src/logmeta.c
Strengthen __pmLogLoadMeta() beyond the rlen < 0 guard: reject empty payloads (rlen <= 0), track remaining body bytes for TYPE_DESC (including name length vs MAXPATHLEN), and enforce type-specific minimum sizes for INDOM/LABEL/TEXT before malloc/parse. Extend qa/2009 to cover total record lengths 12..19. Co-authored-by: Cursor <cursoragent@cursor.com>
__pmLogLoadMeta() rejects undersized metadata records
qa/2009: exercise __pmLogLoadMeta undersized metadata record rejection