We track down a crash in FindLibCppStdFunctionCallableInfo() to a missing nullptr check for the symbol variable.
Diff Detail
Event Timeline
What's the scenario that's causing this? Adding a nullptr check is an obviously safe thing to do, but it would be excellent if we could add a comment explaining why the symbol could be nullptr.
I also do believe that the logic for checking whether the symbol is nullptr can be hoisted to the beginning of the function, see comment inline.
source/Target/CPPLanguageRuntime.cpp | ||
---|---|---|
217–218 | This should probably be nullptr, anyway, my general comment is that this check is scattered all around the function and could be centralized in a single place. | |
262–276 | Here in the if branch you check whether the symbol is nullptr or not, but later you dereference it unconditionally. Are you always guaranteed that you're not dereferencing nullptr ? |
@friss we have several bugs, once of which I can reproduce but I have not been able to reduce it to a minimal case yet and the nullptr check is obviously the right to do.
if (symbol && symbol->GetName() ....