Skip to content

Commit 7d0cfc6

Browse files
committed
C++: Don't override getParameterSizeIndex in the model for Accept. This fixes IR construction of calls to accept.
1 parent 0ff7cc8 commit 7d0cfc6

File tree

4 files changed

+2
-8
lines changed

4 files changed

+2
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ private class Accept extends ArrayFunction, AliasFunction, TaintFunction, SideEf
4646
i = 1 and buffer = false
4747
}
4848

49-
override ParameterIndex getParameterSizeIndex(ParameterIndex i) { i = 1 and result = 2 }
50-
49+
// NOTE: The size parameter is a pointer to the size. So we can't implement `getParameterSizeIndex` for
50+
// this model.
5151
// NOTE: We implement thse two predicates as none because we can't model the low-level changes made to
5252
// the structure pointed to by the file-descriptor argument.
5353
override predicate hasOnlySpecificReadSideEffects() { none() }

cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_consistency.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ instructionWithoutSuccessor
1313
| condition_decls.cpp:41:22:41:23 | Chi: call to BoxedInt | Instruction 'Chi: call to BoxedInt' has no successors in function '$@'. | condition_decls.cpp:40:6:40:20 | void while_decl_bind(int) | void while_decl_bind(int) |
1414
| condition_decls.cpp:48:52:48:53 | Chi: call to BoxedInt | Instruction 'Chi: call to BoxedInt' has no successors in function '$@'. | condition_decls.cpp:47:6:47:18 | void for_decl_bind(int) | void for_decl_bind(int) |
1515
| misc.c:171:10:171:13 | Uninitialized: definition of str2 | Instruction 'Uninitialized: definition of str2' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() |
16-
| modeled-functions.cpp:6:10:6:16 | BufferReadSideEffect: socket2 | Instruction 'BufferReadSideEffect: socket2' has no successors in function '$@'. | modeled-functions.cpp:3:6:3:15 | void testAccept(int, int) | void testAccept(int, int) |
1716
| ms_try_except.cpp:3:9:3:9 | Uninitialized: definition of x | Instruction 'Uninitialized: definition of x' has no successors in function '$@'. | ms_try_except.cpp:2:6:2:18 | void ms_try_except(int) | void ms_try_except(int) |
1817
| ms_try_mix.cpp:11:12:11:15 | Chi: call to C | Instruction 'Chi: call to C' has no successors in function '$@'. | ms_try_mix.cpp:10:6:10:18 | void ms_except_mix(int) | void ms_except_mix(int) |
1918
| ms_try_mix.cpp:28:12:28:15 | Chi: call to C | Instruction 'Chi: call to C' has no successors in function '$@'. | ms_try_mix.cpp:27:6:27:19 | void ms_finally_mix(int) | void ms_finally_mix(int) |

cpp/ql/test/library-tests/syntax-zoo/raw_consistency.expected

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ instructionWithoutSuccessor
3131
| misc.c:174:17:174:22 | CallSideEffect: call to getInt | Instruction 'CallSideEffect: call to getInt' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() |
3232
| misc.c:174:30:174:35 | CallSideEffect: call to getInt | Instruction 'CallSideEffect: call to getInt' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() |
3333
| misc.c:174:55:174:60 | Store: (char ****)... | Instruction 'Store: (char ****)...' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() |
34-
| modeled-functions.cpp:6:10:6:16 | BufferReadSideEffect: socket2 | Instruction 'BufferReadSideEffect: socket2' has no successors in function '$@'. | modeled-functions.cpp:3:6:3:15 | void testAccept(int, int) | void testAccept(int, int) |
3534
| ms_try_except.cpp:3:9:3:9 | Uninitialized: definition of x | Instruction 'Uninitialized: definition of x' has no successors in function '$@'. | ms_try_except.cpp:2:6:2:18 | void ms_try_except(int) | void ms_try_except(int) |
3635
| ms_try_except.cpp:7:13:7:17 | Store: ... = ... | Instruction 'Store: ... = ...' has no successors in function '$@'. | ms_try_except.cpp:2:6:2:18 | void ms_try_except(int) | void ms_try_except(int) |
3736
| ms_try_except.cpp:9:19:9:19 | Load: j | Instruction 'Load: j' has no successors in function '$@'. | ms_try_except.cpp:2:6:2:18 | void ms_try_except(int) | void ms_try_except(int) |
@@ -136,9 +135,6 @@ backEdgeCountMismatch
136135
useNotDominatedByDefinition
137136
| VacuousDestructorCall.cpp:2:29:2:29 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | VacuousDestructorCall.cpp:2:6:2:6 | void CallDestructor<int>(int, int*) | void CallDestructor<int>(int, int*) |
138137
| misc.c:219:47:219:48 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | misc.c:219:5:219:26 | int assign_designated_init(someStruct*) | int assign_designated_init(someStruct*) |
139-
| modeled-functions.cpp:6:19:6:19 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | modeled-functions.cpp:3:6:3:15 | void testAccept(int, int) | void testAccept(int, int) |
140-
| modeled-functions.cpp:6:19:6:19 | BufferSize | Operand 'BufferSize' is not dominated by its definition in function '$@'. | modeled-functions.cpp:3:6:3:15 | void testAccept(int, int) | void testAccept(int, int) |
141-
| modeled-functions.cpp:6:22:6:22 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | modeled-functions.cpp:3:6:3:15 | void testAccept(int, int) | void testAccept(int, int) |
142138
| static_init_templates.cpp:15:1:15:18 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | static_init_templates.cpp:15:1:15:18 | void MyClass::MyClass() | void MyClass::MyClass() |
143139
| try_catch.cpp:21:13:21:24 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | try_catch.cpp:19:6:19:23 | void throw_from_nonstmt(int) | void throw_from_nonstmt(int) |
144140
| vla.c:3:27:3:30 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | vla.c:3:5:3:8 | int main(int, char**) | int main(int, char**) |

cpp/ql/test/library-tests/syntax-zoo/unaliased_ssa_consistency.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ instructionWithoutSuccessor
1313
| condition_decls.cpp:41:22:41:23 | IndirectMayWriteSideEffect: call to BoxedInt | Instruction 'IndirectMayWriteSideEffect: call to BoxedInt' has no successors in function '$@'. | condition_decls.cpp:40:6:40:20 | void while_decl_bind(int) | void while_decl_bind(int) |
1414
| condition_decls.cpp:48:52:48:53 | IndirectMayWriteSideEffect: call to BoxedInt | Instruction 'IndirectMayWriteSideEffect: call to BoxedInt' has no successors in function '$@'. | condition_decls.cpp:47:6:47:18 | void for_decl_bind(int) | void for_decl_bind(int) |
1515
| misc.c:171:10:171:13 | Uninitialized: definition of str2 | Instruction 'Uninitialized: definition of str2' has no successors in function '$@'. | misc.c:168:6:168:8 | void vla() | void vla() |
16-
| modeled-functions.cpp:6:10:6:16 | BufferReadSideEffect: socket2 | Instruction 'BufferReadSideEffect: socket2' has no successors in function '$@'. | modeled-functions.cpp:3:6:3:15 | void testAccept(int, int) | void testAccept(int, int) |
1716
| ms_try_except.cpp:3:9:3:9 | Uninitialized: definition of x | Instruction 'Uninitialized: definition of x' has no successors in function '$@'. | ms_try_except.cpp:2:6:2:18 | void ms_try_except(int) | void ms_try_except(int) |
1817
| ms_try_mix.cpp:11:12:11:15 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' has no successors in function '$@'. | ms_try_mix.cpp:10:6:10:18 | void ms_except_mix(int) | void ms_except_mix(int) |
1918
| ms_try_mix.cpp:28:12:28:15 | IndirectMayWriteSideEffect: call to C | Instruction 'IndirectMayWriteSideEffect: call to C' has no successors in function '$@'. | ms_try_mix.cpp:27:6:27:19 | void ms_finally_mix(int) | void ms_finally_mix(int) |

0 commit comments

Comments
 (0)