Skip to content

Commit e1c4406

Browse files
authored
Merge pull request #5187 from geoffw0/modelsbsl5
C++: Support BSL in Allocation.qll, Deallocation.qll.
2 parents 6db75df + 3323683 commit e1c4406

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

cpp/ql/src/semmle/code/cpp/models/implementations/Allocation.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ private class MallocAllocationFunction extends AllocationFunction {
1515

1616
MallocAllocationFunction() {
1717
// --- C library allocation
18-
hasGlobalOrStdName("malloc") and // malloc(size)
18+
hasGlobalOrStdOrBslName("malloc") and // malloc(size)
1919
sizeArg = 0
2020
or
2121
hasGlobalName([
@@ -104,7 +104,7 @@ private class CallocAllocationFunction extends AllocationFunction {
104104

105105
CallocAllocationFunction() {
106106
// --- C library allocation
107-
hasGlobalOrStdName("calloc") and // calloc(num, size)
107+
hasGlobalOrStdOrBslName("calloc") and // calloc(num, size)
108108
sizeArg = 1 and
109109
multArg = 0
110110
}
@@ -124,7 +124,7 @@ private class ReallocAllocationFunction extends AllocationFunction {
124124

125125
ReallocAllocationFunction() {
126126
// --- C library allocation
127-
hasGlobalOrStdName("realloc") and // realloc(ptr, size)
127+
hasGlobalOrStdOrBslName("realloc") and // realloc(ptr, size)
128128
sizeArg = 1 and
129129
reallocArg = 0
130130
or

cpp/ql/src/semmle/code/cpp/models/implementations/Deallocation.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ private class StandardDeallocationFunction extends DeallocationFunction {
1313
int freedArg;
1414

1515
StandardDeallocationFunction() {
16-
hasGlobalName([
16+
hasGlobalOrStdOrBslName([
1717
// --- C library allocation
18-
"free", "realloc",
18+
"free", "realloc"
19+
]) and
20+
freedArg = 0
21+
or
22+
hasGlobalName([
1923
// --- OpenSSL memory allocation
2024
"CRYPTO_free", "CRYPTO_secure_free"
2125
]) and

0 commit comments

Comments
 (0)