Skip to content

Commit 95e65de

Browse files
committed
C++: Make sure a CatchBlock that catches a const std::bad_alloc& is also a BadAllocCatchBlock.
1 parent 42b8f92 commit 95e65de

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-570/IncorrectAllocationErrorHandling.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ class BadAllocType extends Class {
139139
*/
140140
class BadAllocCatchBlock extends CatchBlock {
141141
BadAllocCatchBlock() {
142-
this.getParameter().getUnspecifiedType() = any(BadAllocType badAlloc).getADerivedClass*()
142+
this.getParameter().getUnspecifiedType().stripType() =
143+
any(BadAllocType badAlloc).getADerivedClass*()
143144
or
144145
not exists(this.getParameter())
145146
}

0 commit comments

Comments
 (0)