mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
C++: Add a MaD model for 'CAtlFileMappingBase' and mark reads as local flow sources.
This commit is contained in:
@@ -54,3 +54,4 @@ private import implementations.CA2AEX
|
||||
private import implementations.CComBSTR
|
||||
private import implementations.CPathT
|
||||
private import implementations.CAtlFile
|
||||
private import implementations.CAtlFileMapping
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import semmle.code.cpp.models.interfaces.FlowSource
|
||||
|
||||
/**
|
||||
* The `CAtlFileMapping` class from Microsoft's Active Template Library.
|
||||
*/
|
||||
class CAtlFileMapping extends Class {
|
||||
CAtlFileMapping() { this.hasGlobalName("CAtlFileMapping") }
|
||||
}
|
||||
|
||||
/**
|
||||
* The `CAtlFileMappingBase` class from Microsoft's Active Template Library.
|
||||
*/
|
||||
class CAtlFileMappingBase extends Class {
|
||||
CAtlFileMappingBase() { this.hasGlobalName("CAtlFileMappingBase") }
|
||||
}
|
||||
|
||||
private class CAtlFileMappingBaseGetData extends MemberFunction, LocalFlowSourceFunction {
|
||||
CAtlFileMappingBaseGetData() {
|
||||
this.getClassAndName("GetData") = any(CAtlFileMappingBase fileMaping).getADerivedClass*()
|
||||
}
|
||||
|
||||
override predicate hasLocalFlowSource(FunctionOutput output, string description) {
|
||||
output.isReturnValueDeref(1) and
|
||||
description = "data read by " + this.getName()
|
||||
}
|
||||
}
|
||||
|
||||
private class CAtlFileMappingGetData extends MemberFunction, LocalFlowSourceFunction {
|
||||
CAtlFileMappingGetData() {
|
||||
this.(ConversionOperator).getDeclaringType() instanceof CAtlFileMapping
|
||||
}
|
||||
|
||||
override predicate hasLocalFlowSource(FunctionOutput output, string description) {
|
||||
output.isReturnValueDeref(1) and
|
||||
description = "data read by " + this.getName()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user