Skip to content

Commit 584adf8

Browse files
committed
C++: restrict flowstates in constant off-by-one query
1 parent f77c77f commit 584adf8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-193/ConstantSizeArrayOffByOne.ql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ predicate pointerArithOverflow(
8989

9090
module FieldAddressToDerefConfig implements DataFlow::StateConfigSig {
9191
newtype FlowState =
92-
additional TArray(Field f) or
93-
additional TOverflowArithmetic(PointerArithmeticInstruction pai)
92+
additional TArray(Field f) { pointerArithOverflow(_, f, _, _, _) } or
93+
additional TOverflowArithmetic(PointerArithmeticInstruction pai) {
94+
pointerArithOverflow(pai, _, _, _, _)
95+
}
9496

9597
predicate isSource(DataFlow::Node source, FlowState state) {
9698
exists(Field f |

0 commit comments

Comments
 (0)