Skip to content

Commit 7bb8065

Browse files
committed
Merge branch 'mathiasvp/replace-ast-with-ir-use-usedataflow' into no-taint-indirect-direct-conflation
2 parents b36d493 + d90d895 commit 7bb8065

File tree

4 files changed

+9
-21
lines changed

4 files changed

+9
-21
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ class PostFieldUpdateNode extends TPostFieldUpdateNode, PartialDefinitionNode {
457457

458458
PostFieldUpdateNode() { this = TPostFieldUpdateNode(fieldAddress, indirectionIndex) }
459459

460-
override Function getFunction() { result = fieldAddress.getUse().getEnclosingFunction() }
460+
override Declaration getFunction() { result = fieldAddress.getUse().getEnclosingFunction() }
461461

462462
override Declaration getEnclosingCallable() { result = this.getFunction() }
463463

@@ -539,7 +539,7 @@ class SideEffectOperandNode extends Node, IndirectOperand {
539539

540540
override Declaration getEnclosingCallable() { result = this.getFunction() }
541541

542-
override Function getFunction() { result = call.getEnclosingFunction() }
542+
override Declaration getFunction() { result = call.getEnclosingFunction() }
543543

544544
Expr getArgument() { result = call.getArgument(argumentIndex).getUnconvertedResultExpression() }
545545
}
@@ -625,7 +625,7 @@ class IndirectParameterNode extends Node, IndirectInstruction {
625625

626626
override Declaration getEnclosingCallable() { result = this.getFunction() }
627627

628-
override Function getFunction() { result = this.getInstruction().getEnclosingFunction() }
628+
override Declaration getFunction() { result = this.getInstruction().getEnclosingFunction() }
629629

630630
override string toStringImpl() {
631631
result = this.getParameter().toString() + " indirection"
@@ -698,7 +698,7 @@ class IndirectArgumentOutNode extends Node, TIndirectArgumentOutNode, PartialDef
698698

699699
override Declaration getEnclosingCallable() { result = this.getFunction() }
700700

701-
override Function getFunction() { result = this.getCallInstruction().getEnclosingFunction() }
701+
override Declaration getFunction() { result = this.getCallInstruction().getEnclosingFunction() }
702702

703703
override Node getPreUpdateNode() { hasOperandAndIndex(result, operand, indirectionIndex) }
704704

@@ -861,7 +861,7 @@ class RawIndirectOperand extends Node, TRawIndirectOperand {
861861
/** Gets the underlying indirection index. */
862862
int getIndirectionIndex() { result = indirectionIndex }
863863

864-
override Function getFunction() { result = this.getOperand().getDef().getEnclosingFunction() }
864+
override Declaration getFunction() { result = this.getOperand().getDef().getEnclosingFunction() }
865865

866866
override Declaration getEnclosingCallable() { result = this.getFunction() }
867867

@@ -902,7 +902,7 @@ class FinalParameterNode extends Node, TFinalParameterNode {
902902
/** Gets the argument index associated with this final use. */
903903
final int getArgumentIndex() { result = p.getIndex() }
904904

905-
override Function getFunction() { result = p.getFunction() }
905+
override Declaration getFunction() { result = p.getFunction() }
906906

907907
override Declaration getEnclosingCallable() { result = this.getFunction() }
908908

@@ -959,7 +959,7 @@ class RawIndirectInstruction extends Node, TRawIndirectInstruction {
959959
/** Gets the underlying indirection index. */
960960
int getIndirectionIndex() { result = indirectionIndex }
961961

962-
override Function getFunction() { result = this.getInstruction().getEnclosingFunction() }
962+
override Declaration getFunction() { result = this.getInstruction().getEnclosingFunction() }
963963

964964
override Declaration getEnclosingCallable() { result = this.getFunction() }
965965

cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
uniqueEnclosingCallable
2-
| globals.cpp:9:5:9:19 | flowTestGlobal1 indirection | Node should have one enclosing callable but has 0. |
3-
| globals.cpp:9:5:9:19 | flowTestGlobal1 indirection | Node should have one enclosing callable but has 0. |
4-
| globals.cpp:16:12:16:26 | flowTestGlobal2 indirection | Node should have one enclosing callable but has 0. |
5-
| globals.cpp:16:12:16:26 | flowTestGlobal2 indirection | Node should have one enclosing callable but has 0. |
62
uniqueType
73
uniqueNodeLocation
84
missingLocation

cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
uniqueEnclosingCallable
2-
| cpp11.cpp:36:5:36:14 | global_int indirection | Node should have one enclosing callable but has 0. |
3-
| cpp11.cpp:36:5:36:14 | global_int indirection | Node should have one enclosing callable but has 0. |
4-
| misc.c:10:5:10:13 | topLevel1 indirection | Node should have one enclosing callable but has 0. |
5-
| misc.c:10:5:10:13 | topLevel1 indirection | Node should have one enclosing callable but has 0. |
6-
| misc.c:11:5:11:13 | topLevel2 indirection | Node should have one enclosing callable but has 0. |
7-
| misc.c:11:5:11:13 | topLevel2 indirection | Node should have one enclosing callable but has 0. |
8-
| misc.c:210:5:210:20 | global_with_init indirection | Node should have one enclosing callable but has 0. |
9-
| misc.c:210:5:210:20 | global_with_init indirection | Node should have one enclosing callable but has 0. |
102
uniqueType
113
uniqueNodeLocation
124
| allocators.cpp:14:5:14:8 | Phi | Node should have one location but has 4. |

cpp/ql/test/query-tests/Security/CWE/CWE-611/tests3.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void test3_2(InputSource &data) {
3535
SAX2XMLReader *p_3_3 = XMLReaderFactory::createXMLReader();
3636

3737
void test3_3(InputSource &data) {
38-
p_3_3->parse(data); // BAD (parser not correctly configured) [NOT DETECTED]
38+
p_3_3->parse(data); // BAD (parser not correctly configured)
3939
}
4040

4141
SAX2XMLReader *p_3_4 = XMLReaderFactory::createXMLReader();
@@ -53,7 +53,7 @@ void test3_5_init() {
5353

5454
void test3_5(InputSource &data) {
5555
test3_5_init();
56-
p_3_5->parse(data); // GOOD
56+
p_3_5->parse(data); // GOOD [FALSE POSITIVE]
5757
}
5858

5959
void test3_6(InputSource &data) {

0 commit comments

Comments
 (0)