Repository navigation
Fix #15139 validate arg indirect attribute before indexing direction array - #8850
Conversation
|
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. |
|
@dmcppcheck can you create a trac ticket for this PR |
|
I have created this ticket: |
|
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. |
|
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/ 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. |
…array (cppcheck-opensource#8850) 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.
loadFunction writes
ac.direction[indirect]whereindirectcomes straight from theindirectattribute of an<arg>element in a--librarycfg file, with no range check, so a value likeindirect="1000000"orindirect="-5"writes outside the fixed 3-elementdirectionarray. Reject an out-of-rangeindirectwithBAD_ATTRIBUTE_VALUE, matching the bounds checkgetArgDirectionalready applies when reading the same array.