C++: Add a MaD model for 'CAtlFile' and mark reads as local flow sources.

This commit is contained in:
Mathias Vorreiter Pedersen
2024-11-27 15:21:45 +00:00
parent dee47f2111
commit 74eae4a18d
4 changed files with 28 additions and 1 deletions

View File

@@ -53,3 +53,4 @@ private import implementations.Win32CommandExecution
private import implementations.CA2AEX
private import implementations.CComBSTR
private import implementations.CPathT
private import implementations.CAtlFile

View File

@@ -0,0 +1,17 @@
import semmle.code.cpp.models.interfaces.FlowSource
/**
* The `CAtlFile` class from Microsoft's Active Template Library.
*/
class CAtlFile extends Class {
CAtlFile() { this.hasGlobalName("CAtlFile") }
}
private class CAtlFileRead extends MemberFunction, LocalFlowSourceFunction {
CAtlFileRead() { this.getClassAndName("Read") instanceof CAtlFile }
override predicate hasLocalFlowSource(FunctionOutput output, string description) {
output.isParameterDeref(0) and
description = "string read by " + this.getName()
}
}