Skip to content

Fix #15139 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

@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.

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