-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix #14305 Wrong buffer sizes computed by valueFlowDynamicBufferSize() #8006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
danmar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see why we want to have different results from ValueType::typeSize and ValueFlow::getSizeOf. Can you explain it? Did you consider refactoring so that ValueType::typeSize calls ValueFlow::getSizeOf or vice versa?
Yes, having those two functions is unfortunate, and they should be merged. |
|
BTW, is daca down? I haven't been able to connect to http://cppcheck1.osuosl.org:8000/ for a while. |
The server did not start up because the package index was corrupted. It is fixed now. |
Clients process data again. Had been broken for over a week. |
lib/valueflow.cpp
Outdated
| ValueType vt = *typeTok->valueType(); | ||
| if (vt.pointer > 0) | ||
| --vt.pointer; | ||
| const size_t typeSize = vt.getSizeOf(settings, ValueType::Accuracy::ExactOrZero, ValueType::SizeOf::Pointer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not check how this works.. but do we have to create a temporary?
I spontanously wonder; can't the 3rd argument be typeTok->valueType()->pointer > 1 ? ValueType::Sizeof::Pointer : ValueType::SizeOf::Pointee or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that should no longer be necessary.
|
| "}"; | ||
| values = tokenValues(code, "( D )"); | ||
| ASSERT_EQUALS(1U, values.size()); | ||
| TODO_ASSERT_EQUALS(2 * settings.platform.sizeof_pointer, 1, values.back().intvalue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was already incorrect before.



No description provided.