This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Fix crash in GenericTaintChecker when propagatig taint to AllocaRegion
ClosedPublic

Authored by tomasz-kaminski-sonarsource on Jul 20 2023, 7:59 AM.

Details

Summary

The GenericTaintChecker checker was crashing, when the taint
was propagated to AllocaRegion region in following code:

int x;
void* p = alloca(10);
mempcy(p, &x, sizeof(x));

This crash was caused by the fact that determining type of
AllocaRegion returns a null QualType.

This patch makes AllocaRegion expose its type as void,
making them consistent with results of malloc or new
that produce SymRegion with void* symbol.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald Transcript
tomasz-kaminski-sonarsource requested review of this revision.Jul 20 2023, 7:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2023, 7:59 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I belive this fix to be the correct approach, as it reduces the number of edge cases to deal with.
We are using it on internal fork for over a year now, and haven't found any negative impact.

steakhal accepted this revision.Jul 20 2023, 9:10 AM

Makes sense to me. Please, someone else also have a look.

This revision is now accepted and ready to land.Jul 20 2023, 9:10 AM
This revision was landed with ongoing or failed builds.Jul 24 2023, 1:57 AM
This revision was automatically updated to reflect the committed changes.