Skip to content

Commit 3c14266

Browse files
authored
Merge branch 'github:main' into prompt-injection
2 parents 1ec82d9 + 44089d8 commit 3c14266

File tree

172 files changed

+35810
-33522
lines changed

Some content is hidden

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

172 files changed

+35810
-33522
lines changed

cpp/ql/lib/semmle/code/cpp/rangeanalysis/SimpleRangeAnalysis.qll

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -158,22 +158,6 @@ private class UnsignedBitwiseAndExpr extends BitwiseAndExpr {
158158
}
159159
}
160160

161-
/**
162-
* Gets the floor of `v`, with additional logic to work around issues with
163-
* large numbers.
164-
*/
165-
bindingset[v]
166-
float safeFloor(float v) {
167-
// return the floor of v
168-
v.abs() < 2.pow(31) and
169-
result = v.floor()
170-
or
171-
// `floor()` doesn't work correctly on large numbers (since it returns an integer),
172-
// so fall back to unrounded numbers at this scale.
173-
not v.abs() < 2.pow(31) and
174-
result = v
175-
}
176-
177161
/** A `MulExpr` where exactly one operand is constant. */
178162
private class MulByConstantExpr extends MulExpr {
179163
float constant;
@@ -1266,7 +1250,7 @@ private float getLowerBoundsImpl(Expr expr) {
12661250
rsExpr = expr and
12671251
left = getFullyConvertedLowerBounds(rsExpr.getLeftOperand()) and
12681252
right = getValue(rsExpr.getRightOperand().getFullyConverted()).toInt() and
1269-
result = safeFloor(left / 2.pow(right))
1253+
result = (left / 2.pow(right)).floorFloat()
12701254
)
12711255
// Not explicitly modeled by a SimpleRangeAnalysisExpr
12721256
) and
@@ -1475,7 +1459,7 @@ private float getUpperBoundsImpl(Expr expr) {
14751459
rsExpr = expr and
14761460
left = getFullyConvertedUpperBounds(rsExpr.getLeftOperand()) and
14771461
right = getValue(rsExpr.getRightOperand().getFullyConverted()).toInt() and
1478-
result = safeFloor(left / 2.pow(right))
1462+
result = (left / 2.pow(right)).floorFloat()
14791463
)
14801464
// Not explicitly modeled by a SimpleRangeAnalysisExpr
14811465
) and

cpp/ql/test/library-tests/ir/ir/PrintAST.expected

Lines changed: 10164 additions & 10132 deletions
Large diffs are not rendered by default.

cpp/ql/test/library-tests/ir/ir/aliased_ir.expected

Lines changed: 9142 additions & 9072 deletions
Large diffs are not rendered by default.

cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ invalidOverlap
2727
nonUniqueEnclosingIRFunction
2828
fieldAddressOnNonPointer
2929
thisArgumentIsNonPointer
30-
| ir.cpp:2546:34:2546:34 | Call: call to operator bool | Call instruction 'Call: call to operator bool' has a `this` argument operand that is not an address, in function '$@'. | ir.cpp:2545:6:2545:23 | void this_inconsistency(bool) | void this_inconsistency(bool) |
30+
| ir.cpp:2548:34:2548:34 | Call: call to operator bool | Call instruction 'Call: call to operator bool' has a `this` argument operand that is not an address, in function '$@'. | ir.cpp:2547:6:2547:23 | void this_inconsistency(bool) | void this_inconsistency(bool) |
3131
nonUniqueIRVariable
3232
nonBooleanOperand
3333
missingCppType

cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ invalidOverlap
2727
nonUniqueEnclosingIRFunction
2828
fieldAddressOnNonPointer
2929
thisArgumentIsNonPointer
30-
| ir.cpp:2546:34:2546:34 | Call: call to operator bool | Call instruction 'Call: call to operator bool' has a `this` argument operand that is not an address, in function '$@'. | ir.cpp:2545:6:2545:23 | void this_inconsistency(bool) | void this_inconsistency(bool) |
30+
| ir.cpp:2548:34:2548:34 | Call: call to operator bool | Call instruction 'Call: call to operator bool' has a `this` argument operand that is not an address, in function '$@'. | ir.cpp:2547:6:2547:23 | void this_inconsistency(bool) | void this_inconsistency(bool) |
3131
nonUniqueIRVariable
3232
nonBooleanOperand
3333
missingCppType

cpp/ql/test/library-tests/ir/ir/ir.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,8 @@ void VectorTypes(int i) {
12141214
vi4[i] = x;
12151215
vector(4, int) vi4_shuffle = __builtin_shufflevector(vi4, vi4, 3+0, 2, 1, 0);
12161216
vi4 = vi4 + vi4_shuffle;
1217+
vi4 = vi4 && vi4_shuffle;
1218+
vi4 = vi4 || vi4_shuffle;
12171219
}
12181220

12191221
void *memcpy(void *dst, void *src, int size);

cpp/ql/test/library-tests/ir/ir/raw_consistency.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ multipleIRTypes
2020
lostReachability
2121
backEdgeCountMismatch
2222
useNotDominatedByDefinition
23-
| ir.cpp:1535:8:1535:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1535:8:1535:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() |
23+
| ir.cpp:1537:8:1537:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1537:8:1537:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() |
2424
switchInstructionWithoutDefaultEdge
2525
notMarkedAsConflated
2626
wronglyMarkedAsConflated
2727
invalidOverlap
2828
nonUniqueEnclosingIRFunction
2929
fieldAddressOnNonPointer
3030
thisArgumentIsNonPointer
31-
| ir.cpp:2546:34:2546:34 | Call: call to operator bool | Call instruction 'Call: call to operator bool' has a `this` argument operand that is not an address, in function '$@'. | ir.cpp:2545:6:2545:23 | void this_inconsistency(bool) | void this_inconsistency(bool) |
31+
| ir.cpp:2548:34:2548:34 | Call: call to operator bool | Call instruction 'Call: call to operator bool' has a `this` argument operand that is not an address, in function '$@'. | ir.cpp:2547:6:2547:23 | void this_inconsistency(bool) | void this_inconsistency(bool) |
3232
nonUniqueIRVariable
3333
nonBooleanOperand
3434
missingCppType

0 commit comments

Comments
 (0)