Uh oh!
There was an error while loading. Please reload this page.
Fix #7570: Support address-of operator on variables in getBufferSize() - #7767
Conversation
… in `getBufferSize()`
chrchr-github
commented
Aug 23, 2025
Thanks for your contribution. |
flovent
commented
Aug 23, 2025
This patch didn't consider that because
Should we remove |
Ok, so maybe we should add a negative test/TODO for that case?
Ideally we would say 'Variable' for &i and just mention |
I mean something like this, it's not triggered now. And also, there is a |
| if (!tok->isUnaryOp("&")) | ||
| return tok; | ||
| const auto* op = tok->astOperand1(); |
There was a problem hiding this comment.
Please use Token here since it's not much longer than auto.
danmar
left a comment
There was a problem hiding this comment.
could you run the tools/test-my-pr.py script please? to see what warnings this will produce and then we can see if there are false positives.
Uh oh!
There was an error while loading. Please reload this page.
try to run it yourself first. if you have trouble to run it maybe we can run it on some vm.. maybe you can run on 1000 packages or something like that.. |
flovent
commented
Aug 29, 2025
I try to run it locally, but it seems will take a long time since my cpu only has 6 cores and 12 threads. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
danmar
commented
Sep 27, 2025
I merged this. Thank you for your contribution! Is your name listed in our AUTHORS file? Otherwise can you create a PR that adds your name to AUTHORS please? |
flovent
commented
Sep 27, 2025
My pleasure! That's my first commit to cppcheck, i just create #7858. |



Detect address-of token in
getBufferSize()and get the underlying variable's corresponding buffer size.stringNotZeroTerminated()also callsgetBuffersize(), so it will also benefit.