C++: Support BSL in Allocation.qll, Deallocation.qll.

This commit is contained in:
Geoffrey White
2021-02-16 19:10:39 +00:00
parent 92df1f7a3d
commit 3323683ab2
2 changed files with 9 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ private class MallocAllocationFunction extends AllocationFunction {
MallocAllocationFunction() {
// --- C library allocation
hasGlobalOrStdName("malloc") and // malloc(size)
hasGlobalOrStdOrBslName("malloc") and // malloc(size)
sizeArg = 0
or
hasGlobalName([
@@ -104,7 +104,7 @@ private class CallocAllocationFunction extends AllocationFunction {
CallocAllocationFunction() {
// --- C library allocation
hasGlobalOrStdName("calloc") and // calloc(num, size)
hasGlobalOrStdOrBslName("calloc") and // calloc(num, size)
sizeArg = 1 and
multArg = 0
}
@@ -124,7 +124,7 @@ private class ReallocAllocationFunction extends AllocationFunction {
ReallocAllocationFunction() {
// --- C library allocation
hasGlobalOrStdName("realloc") and // realloc(ptr, size)
hasGlobalOrStdOrBslName("realloc") and // realloc(ptr, size)
sizeArg = 1 and
reallocArg = 0
or

View File

@@ -13,9 +13,13 @@ private class StandardDeallocationFunction extends DeallocationFunction {
int freedArg;
StandardDeallocationFunction() {
hasGlobalName([
hasGlobalOrStdOrBslName([
// --- C library allocation
"free", "realloc",
"free", "realloc"
]) and
freedArg = 0
or
hasGlobalName([
// --- OpenSSL memory allocation
"CRYPTO_free", "CRYPTO_secure_free"
]) and