Skip to content

validate arg indirect attribute before indexing direction array - #8850

Open
Nussu06 wants to merge 2 commits into
cppcheck-opensource:mainfrom
Nussu06:library-indirect-bounds
Open

Nussu06 wants to merge 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
@dmcppcheck

Copy link
Copy Markdown

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

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