In D30691 code was added to getRuntimeDefinition that does not handle the case when FD==nullptr.
Add regression test.
Differential D45564
[analyzer] Fix null deref in AnyFunctionCall::getRuntimeDefinition r.stahl on Apr 12 2018, 5:14 AM. Authored by
Details In D30691 code was added to getRuntimeDefinition that does not handle the case when FD==nullptr. Add regression test.
Diff Detail
Event TimelineComment Actions I encountered this with a construct like this: struct S { void (*fp)(); }; int main() { struct S s; s.fp(); } Comment Actions We encountered the same problem but did not have time yet to submit the patch. We have literally the same fix internally, so it looks good to me. One minor style nit inline. Could you add your repro as a regression test? You can also extend existing CTU tests just make sure to trigger the crash before the patch. Thank you for the submission and the minimal reproducer.
Comment Actions addressed review comments. I created a new test because certain checkers would cause early exits in the engine (because of undefined func ptr) and not cause the crash. Since I don't have commit access, please commit for me. |
We usually do not write the braces for single statements.