Skip to content

Fix #15139 validate arg indirect attribute before indexing direction array - #8850

Merged
danmar merged 2 commits into
cppcheck-opensource:mainfrom
Nussu06:library-indirect-bounds
Nov 4, 2026
Merged

danmar merged 2 commits into
cppcheck-opensource:mainfrom
Nussu06:library-indirect-bounds

Conversation

@Nussu06

@Nussu06 Nussu06 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

loadFunction writes ac.direction[indirect] where indirect comes straight from the indirect attribute of an <arg> element in a --library cfg file, with no range check, so a value like indirect="1000000" or indirect="-5" writes outside the fixed 3-element direction array. Reject an out-of-range indirect with BAD_ATTRIBUTE_VALUE, matching the bounds check getArgDirection already applies when reading the same array.

Comment thread lib/library.cpp Fixed
Comment thread lib/library.cpp Resolved
@dmcppcheck

Copy link
Copy Markdown
Contributor

There should probably be a trac ticket for this PR. Please create it, or ask us to create it. Then the PR title should be updated.

@Nussu06

Nussu06 commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

@dmcppcheck can you create a trac ticket for this PR

@danmar

danmar commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

I have created this ticket:
https://trac.cppcheck.net/ticket/15139

@Nussu06 Nussu06 changed the title validate arg indirect attribute before indexing direction array Fix #15139 validate arg indirect attribute before indexing direction array Oct 27, 2026
@Nussu06

Nussu06 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for creating it. I've updated the title to reference #15139. The Cppcheck Premium job is passing now with the merged suppression list, so no inline suppression was needed.

@dmcppcheck

Copy link
Copy Markdown
Contributor

Test results for commit 6bb41b0 (tools/test-my-pr.py, main compared to this PR):

Test: http://ec2-16-170-140-253.eu-north-1.compute.amazonaws.com/pr-8850/
packages: 200
Differing warnings: 0 (+0 -0)
Timing: +0.4% (http://ec2-16-170-140-253.eu-north-1.compute.amazonaws.com/pr-8850/2026-10-05_19-05-43-6bb41b063e13_timing.html)

Posted automatically by the cppcheck PR test runner. +N: warnings only with this PR, -N: warnings only with main. The AI review is written by Claude and can be wrong.

@danmar
danmar merged commit 7df423c into cppcheck-opensource:main Nov 4, 2026
71 checks passed
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.

4 participants