Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit acca39b

Browse files
committed
C++: Repair following merge.
1 parent 0da826f commit acca39b

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

change-notes/1.24/analysis-cpp.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ The following changes in version 1.24 affect C/C++ analysis in all applications.
2020

2121
## Changes to libraries
2222

23-
*
2423
* Created the `semmle.code.cpp.models.interfaces.Allocation` library to model allocation such as `new` expressions and calls to `malloc`. This in intended to replace the functionality in `semmle.code.cpp.commons.Alloc` with a more consistent and useful interface.
2524
* Created the `semmle.code.cpp.models.interfaces.Deallocation` library to model deallocation such as `delete` expressions and calls to `free`. This in intended to replace the functionality in `semmle.code.cpp.commons.Alloc` with a more consistent and useful interface.
2625
* The new class `StackVariable` should be used in place of `LocalScopeVariable`

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ class MallocAllocationFunction extends AllocationFunction {
8080
or
8181
// alloca(size)
8282
name = "alloca" and sizeArg = 0
83+
or
84+
// kmem_alloc(size, flags)
85+
name = "kmem_alloc" and sizeArg = 0
86+
or
87+
// kmem_zalloc(size, flags)
88+
name = "kmem_zalloc" and sizeArg = 0
8389
)
8490
)
8591
}
@@ -194,6 +200,12 @@ class StrdupAllocationFunction extends AllocationFunction {
194200
or
195201
// MmMapLockedPagesSpecifyCache(list, mode, type, address, flag, flag)
196202
name = "MmMapLockedPagesSpecifyCache"
203+
or
204+
// pool_get(pool, flags)
205+
name = "pool_get"
206+
or
207+
// pool_cache_get(pool, flags)
208+
name = "pool_cache_get"
197209
)
198210
)
199211
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ class StandardDeallocationFunction extends DeallocationFunction {
6666
name = "HeapReAlloc" and freedArg = 2
6767
or
6868
name = "CoTaskMemRealloc" and freedArg = 0
69+
or
70+
name = "kmem_free" and freedArg = 0
71+
or
72+
name = "pool_put" and freedArg = 1
73+
or
74+
name = "pool_cache_put" and freedArg = 1
6975
)
7076
)
7177
}

0 commit comments

Comments
 (0)