-
Notifications
You must be signed in to change notification settings - Fork 76
MEM53-CPP: False positive due to flow through realloc #420
Copy link
Copy link
Open
Labels
Difficulty-MediumA false positive or false negative report which is expected to take 1-5 days effort to addressA false positive or false negative report which is expected to take 1-5 days effort to addressImpact-LowStardard-CERT-C++false positive/false negativeAn issue related to observed false positives or false negatives.An issue related to observed false positives or false negatives.
Metadata
Metadata
Assignees
Labels
Difficulty-MediumA false positive or false negative report which is expected to take 1-5 days effort to addressA false positive or false negative report which is expected to take 1-5 days effort to addressImpact-LowStardard-CERT-C++false positive/false negativeAn issue related to observed false positives or false negatives.An issue related to observed false positives or false negatives.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Triaged
Affected rules
MEM53-CPPDescription
In github/codeql#14637 we added taint-flow through the indirection of the pointer passed to
reallocto the indirection of the result. That is, flow through the following example:this relies on the new taint-tracking library to distinguish between the result of
realloc(...), and the result of whatrealloc(...)points to. Since the old AST-based taint-tracking library cannot do this this results in a FP in the testcases forMEM53-CPP(that we accepted on thenextbranch here: #419)The query already tries to rule out
realloccases by excluding them in the definition of the taint-tracking configuration'sisSource, but to get this query back to not reporting a FP here a barrier onreallocwould have to be inserted.As @jketema points out the affected test is actually really sketchy since there’s no guarantee that memory allocated with
newcan safely berealloc'ed. So maybe this scenario should be thought about more carefully by someone on your team.