Skip to content

Commit 8cee4f3

Browse files
committed
Merge branch 'main' into inline-5
2 parents c2be2c2 + 93ad204 commit 8cee4f3

File tree

371 files changed

+7208
-3698
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

371 files changed

+7208
-3698
lines changed

cpp/ql/lib/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## 0.8.0
2+
3+
### New Features
4+
5+
* The `ProductFlow::StateConfigSig` signature now includes default predicates for `isBarrier1`, `isBarrier2`, `isAdditionalFlowStep1`, and `isAdditionalFlowStep1`. Hence, it is no longer needed to provide `none()` implementations of these predicates if they are not needed.
6+
7+
### Minor Analysis Improvements
8+
9+
* Deleted the deprecated `getURL` predicate from the `Container`, `Folder`, and `File` classes. Use the `getLocation` predicate instead.
10+
11+
## 0.7.4
12+
13+
No user-facing changes.
14+
115
## 0.7.3
216

317
### Minor Analysis Improvements

cpp/ql/lib/change-notes/2023-06-19-delete-container-url.md

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The `IRGuards` library has improved handling of pointer addition and subtraction operations.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.7.4
2+
3+
No user-facing changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## 0.8.0
2+
3+
### New Features
4+
5+
* The `ProductFlow::StateConfigSig` signature now includes default predicates for `isBarrier1`, `isBarrier2`, `isAdditionalFlowStep1`, and `isAdditionalFlowStep1`. Hence, it is no longer needed to provide `none()` implementations of these predicates if they are not needed.
6+
7+
### Minor Analysis Improvements
8+
9+
* Deleted the deprecated `getURL` predicate from the `Container`, `Folder`, and `File` classes. Use the `getLocation` predicate instead.

cpp/ql/lib/codeql-pack.release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 0.7.3
2+
lastReleaseVersion: 0.8.0

cpp/ql/lib/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cpp-all
2-
version: 0.7.4-dev
2+
version: 0.8.1-dev
33
groups: cpp
44
dbscheme: semmlecode.cpp.dbscheme
55
extractor: cpp

cpp/ql/lib/semmle/code/cpp/controlflow/IRGuards.qll

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,20 @@ private predicate sub_lt(
627627
x = int_value(rhs.getRight()) and
628628
k = c - x
629629
)
630+
or
631+
exists(PointerSubInstruction lhs, int c, int x |
632+
compares_lt(cmp, lhs.getAUse(), right, c, isLt, testIsTrue) and
633+
left = lhs.getLeftOperand() and
634+
x = int_value(lhs.getRight()) and
635+
k = c + x
636+
)
637+
or
638+
exists(PointerSubInstruction rhs, int c, int x |
639+
compares_lt(cmp, left, rhs.getAUse(), c, isLt, testIsTrue) and
640+
right = rhs.getLeftOperand() and
641+
x = int_value(rhs.getRight()) and
642+
k = c - x
643+
)
630644
}
631645

632646
// left + x < right + c => left < right + (c-x)
@@ -653,6 +667,26 @@ private predicate add_lt(
653667
) and
654668
k = c + x
655669
)
670+
or
671+
exists(PointerAddInstruction lhs, int c, int x |
672+
compares_lt(cmp, lhs.getAUse(), right, c, isLt, testIsTrue) and
673+
(
674+
left = lhs.getLeftOperand() and x = int_value(lhs.getRight())
675+
or
676+
left = lhs.getRightOperand() and x = int_value(lhs.getLeft())
677+
) and
678+
k = c - x
679+
)
680+
or
681+
exists(PointerAddInstruction rhs, int c, int x |
682+
compares_lt(cmp, left, rhs.getAUse(), c, isLt, testIsTrue) and
683+
(
684+
right = rhs.getLeftOperand() and x = int_value(rhs.getRight())
685+
or
686+
right = rhs.getRightOperand() and x = int_value(rhs.getLeft())
687+
) and
688+
k = c + x
689+
)
656690
}
657691

658692
// left - x == right + c => left == right + (c+x)
@@ -673,6 +707,20 @@ private predicate sub_eq(
673707
x = int_value(rhs.getRight()) and
674708
k = c - x
675709
)
710+
or
711+
exists(PointerSubInstruction lhs, int c, int x |
712+
compares_eq(cmp, lhs.getAUse(), right, c, areEqual, testIsTrue) and
713+
left = lhs.getLeftOperand() and
714+
x = int_value(lhs.getRight()) and
715+
k = c + x
716+
)
717+
or
718+
exists(PointerSubInstruction rhs, int c, int x |
719+
compares_eq(cmp, left, rhs.getAUse(), c, areEqual, testIsTrue) and
720+
right = rhs.getLeftOperand() and
721+
x = int_value(rhs.getRight()) and
722+
k = c - x
723+
)
676724
}
677725

678726
// left + x == right + c => left == right + (c-x)
@@ -699,6 +747,26 @@ private predicate add_eq(
699747
) and
700748
k = c + x
701749
)
750+
or
751+
exists(PointerAddInstruction lhs, int c, int x |
752+
compares_eq(cmp, lhs.getAUse(), right, c, areEqual, testIsTrue) and
753+
(
754+
left = lhs.getLeftOperand() and x = int_value(lhs.getRight())
755+
or
756+
left = lhs.getRightOperand() and x = int_value(lhs.getLeft())
757+
) and
758+
k = c - x
759+
)
760+
or
761+
exists(PointerAddInstruction rhs, int c, int x |
762+
compares_eq(cmp, left, rhs.getAUse(), c, areEqual, testIsTrue) and
763+
(
764+
right = rhs.getLeftOperand() and x = int_value(rhs.getRight())
765+
or
766+
right = rhs.getRightOperand() and x = int_value(rhs.getLeft())
767+
) and
768+
k = c + x
769+
)
702770
}
703771

704772
/** The int value of integer constant expression. */

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,6 @@ module Impl<FullStateConfigSig Config> {
460460
* The Boolean `cc` records whether the node is reached through an
461461
* argument in a call.
462462
*/
463-
pragma[assume_small_delta]
464463
private predicate fwdFlow(NodeEx node, Cc cc) {
465464
sourceNode(node, _) and
466465
if hasSourceCallCtx() then cc = true else cc = false
@@ -570,7 +569,6 @@ module Impl<FullStateConfigSig Config> {
570569
/**
571570
* Holds if `c` is the target of a store in the flow covered by `fwdFlow`.
572571
*/
573-
pragma[assume_small_delta]
574572
pragma[nomagic]
575573
private predicate fwdFlowConsCand(Content c) {
576574
exists(NodeEx mid, NodeEx node |
@@ -1216,7 +1214,6 @@ module Impl<FullStateConfigSig Config> {
12161214
fwdFlow1(_, _, _, _, _, _, t0, t, ap, _) and t0 != t
12171215
}
12181216

1219-
pragma[assume_small_delta]
12201217
pragma[nomagic]
12211218
private predicate fwdFlow0(
12221219
NodeEx node, FlowState state, Cc cc, ParamNodeOption summaryCtx, TypOption argT,
@@ -2777,7 +2774,6 @@ module Impl<FullStateConfigSig Config> {
27772774
/**
27782775
* Gets the number of `AccessPath`s that correspond to `apa`.
27792776
*/
2780-
pragma[assume_small_delta]
27812777
private int countAps(AccessPathApprox apa) {
27822778
evalUnfold(apa, false) and
27832779
result = 1 and
@@ -2796,7 +2792,6 @@ module Impl<FullStateConfigSig Config> {
27962792
* that it is expanded to a precise head-tail representation.
27972793
*/
27982794
language[monotonicAggregates]
2799-
pragma[assume_small_delta]
28002795
private int countPotentialAps(AccessPathApprox apa) {
28012796
apa instanceof AccessPathApproxNil and result = 1
28022797
or
@@ -2833,7 +2828,6 @@ module Impl<FullStateConfigSig Config> {
28332828
}
28342829

28352830
private newtype TPathNode =
2836-
pragma[assume_small_delta]
28372831
TPathNodeMid(
28382832
NodeEx node, FlowState state, CallContext cc, SummaryCtx sc, DataFlowType t, AccessPath ap
28392833
) {
@@ -2918,7 +2912,6 @@ module Impl<FullStateConfigSig Config> {
29182912

29192913
override AccessPathFrontHead getFront() { result = TFrontHead(head_) }
29202914

2921-
pragma[assume_small_delta]
29222915
override AccessPathApproxCons getApprox() {
29232916
result = TConsNil(head_, t) and tail_ = TAccessPathNil()
29242917
or
@@ -2927,7 +2920,6 @@ module Impl<FullStateConfigSig Config> {
29272920
result = TCons1(head_, this.length())
29282921
}
29292922

2930-
pragma[assume_small_delta]
29312923
override int length() { result = 1 + tail_.length() }
29322924

29332925
private string toStringImpl(boolean needsSuffix) {
@@ -3379,7 +3371,6 @@ module Impl<FullStateConfigSig Config> {
33793371
* Holds if data may flow from `mid` to `node`. The last step in or out of
33803372
* a callable is recorded by `cc`.
33813373
*/
3382-
pragma[assume_small_delta]
33833374
pragma[nomagic]
33843375
private predicate pathStep0(
33853376
PathNodeMid mid, NodeEx node, FlowState state, CallContext cc, SummaryCtx sc, DataFlowType t,
@@ -3592,7 +3583,6 @@ module Impl<FullStateConfigSig Config> {
35923583
)
35933584
}
35943585

3595-
pragma[assume_small_delta]
35963586
pragma[nomagic]
35973587
private predicate pathThroughCallable0(
35983588
DataFlowCall call, PathNodeMid mid, ReturnKindExt kind, FlowState state, CallContext cc,

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ private module LambdaFlow {
187187
else any()
188188
}
189189

190-
pragma[assume_small_delta]
191190
pragma[nomagic]
192191
predicate revLambdaFlow0(
193192
DataFlowCall lambdaCall, LambdaCallKind kind, Node node, DataFlowType t, boolean toReturn,
@@ -274,7 +273,6 @@ private module LambdaFlow {
274273
)
275274
}
276275

277-
pragma[assume_small_delta]
278276
pragma[nomagic]
279277
predicate revLambdaFlowOut(
280278
DataFlowCall lambdaCall, LambdaCallKind kind, TReturnPositionSimple pos, DataFlowType t,

0 commit comments

Comments
 (0)