elisa-tech / tsc

Coordination between ELISA working groups, and repository for documentation based deliverables.
57 stars 14 forks source link

crix-callgraph: fix a use-after-scope memory error in VirtualCallTargets.cpp #72

Open BrettDong opened 2 years ago

BrettDong commented 2 years ago

llvm::function_ref stores a reference but does not own a callable object [1]. LookupDomTree of that type is assigned to a local lambda object in VirtualCallTargets::run() and is used later in VirtualCallTargets::scanTypeTestUsers(), but the local lambda object is already out of scope at that time, and crashes the program on my computer. This pull request changes the type of LookupDomTree to std::function, which owns a callable object.

[1] LLVM reference


Signed-off-by: Binrui Dong brett.browning.dong@gmail.com

pahmann commented 1 year ago

@bulwahn do you agree to the fix. After merging the latest issue found by @henrirosten we can see that we rebase this PR in a way that the Travis CI will pass again.