Skip to content

Commit 49c4c55

Browse files
author
Dave Bartolomeo
committed
Merge from main
2 parents 23b572e + e8f9429 commit 49c4c55

File tree

486 files changed

+6861
-2468
lines changed

Some content is hidden

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

486 files changed

+6861
-2468
lines changed

.github/labeler.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,11 @@ documentation:
4343
"QL-for-QL":
4444
- ql/**/*
4545
- .github/workflows/ql-for-ql*
46+
47+
# Since these are all shared files that need to be synced, just pick _one_ copy of each.
48+
"DataFlow Library":
49+
- "java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl.qll"
50+
- "java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll"
51+
- "java/ql/lib/semmle/code/java/dataflow/internal/tainttracking1/TaintTrackingImpl.qll"
52+
- "java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll"
53+
- "java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll"

.github/workflows/ruby-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ jobs:
9696
- name: Build Query Pack
9797
run: |
9898
codeql pack create ../shared/ssa --output target/packs
99+
codeql pack create ../misc/suite-helpers --output target/packs
99100
codeql pack create ql/lib --output target/packs
100-
codeql pack install ql/src
101101
codeql pack create ql/src --output target/packs
102102
PACK_FOLDER=$(readlink -f target/packs/codeql/ruby-queries/*)
103103
codeql generate query-help --format=sarifv2.1.0 --output="${PACK_FOLDER}/rules.sarif" ql/src
@@ -202,7 +202,7 @@ jobs:
202202
echo 'name: sample-tests
203203
version: 0.0.0
204204
dependencies:
205-
codeql/ruby-all: 0.0.1
205+
codeql/ruby-all: "*"
206206
extractor: ruby
207207
tests: .
208208
' > qlpack.yml

change-notes/1.20/analysis-javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
| Unneeded defensive code | More true positive and fewer false positive results | This query now recognizes additional defensive code patterns. |
5353
| Unsafe dynamic method access | Fewer false positive results | This query no longer flags concatenated strings as unsafe method names. |
5454
| Unused parameter | Fewer false positive results | This query no longer flags parameters with leading underscore. |
55-
| Unused variable, import, function or class | Fewer false positive results | This query now flags fewer variables that are implictly used by JSX elements. It no longer flags variables with a leading underscore and variables in dead code. |
55+
| Unused variable, import, function or class | Fewer false positive results | This query now flags fewer variables that are implicitly used by JSX elements. It no longer flags variables with a leading underscore and variables in dead code. |
5656
| Unvalidated dynamic method call | More true positive results | This query now flags concatenated strings as unvalidated method names in more cases. |
5757
| Useless assignment to property. | Fewer false positive results | This query now treats assignments with complex right-hand sides correctly. |
5858
| Useless conditional | Fewer results | Additional defensive coding patterns are now ignored. |

change-notes/1.23/analysis-cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The following changes in version 1.23 affect C/C++ analysis in all applications.
1919
| Hard-coded Japanese era start date in call (`cpp/japanese-era/constructor-or-method-with-exact-era-date`) | Deprecated | This query has been deprecated. Use the new combined query Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) instead. |
2020
| Hard-coded Japanese era start date in struct (`cpp/japanese-era/struct-with-exact-era-date`) | Deprecated | This query has been deprecated. Use the new combined query Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) instead. |
2121
| Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) | More correct results | This query now checks for the beginning date of the Reiwa era (1st May 2019). |
22-
| Non-constant format string (`cpp/non-constant-format`) | Fewer false positive results | Fixed false positive results triggrered by mismatching declarations of a formatting function. |
22+
| Non-constant format string (`cpp/non-constant-format`) | Fewer false positive results | Fixed false positive results triggered by mismatching declarations of a formatting function. |
2323
| Sign check of bitwise operation (`cpp/bitwise-sign-check`) | Fewer false positive results | Results involving `>=` or `<=` are no longer reported. |
2424
| Too few arguments to formatting function (`cpp/wrong-number-format-arguments`) | Fewer false positive results | Fixed false positive results triggered by mismatching declarations of a formatting function. |
2525
| Too many arguments to formatting function (`cpp/too-many-format-arguments`) | Fewer false positive results | Fixed false positive results triggered by mismatching declarations of a formatting function. |

change-notes/1.24/analysis-javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
## Changes to libraries
9393

94-
* The predicates `RegExpTerm.getSuccessor` and `RegExpTerm.getPredecessor` have been changed to reflect textual, not operational, matching order. This only makes a difference in lookbehind assertions, which are operationally matched backwards. Previously, `getSuccessor` would mimick this, so in an assertion `(?<=ab)` the term `b` would be considered the predecessor, not the successor, of `a`. Textually, however, `a` is still matched before `b`, and this is the order we now follow.
94+
* The predicates `RegExpTerm.getSuccessor` and `RegExpTerm.getPredecessor` have been changed to reflect textual, not operational, matching order. This only makes a difference in lookbehind assertions, which are operationally matched backwards. Previously, `getSuccessor` would mimic this, so in an assertion `(?<=ab)` the term `b` would be considered the predecessor, not the successor, of `a`. Textually, however, `a` is still matched before `b`, and this is the order we now follow.
9595
* An extensible model of the `EventEmitter` pattern has been implemented.
9696
* Taint-tracking configurations now interact differently with the `data` flow label, which may affect queries
9797
that combine taint-tracking and flow labels.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Fixed bugs in the `FormatLiteral` class that were causing `getMaxConvertedLength` and related predicates to return no results when the format literal was `%e`, `%f` or `%g` and an explicit precision was specified.

cpp/ql/lib/semmle/code/cpp/commons/Printf.qll

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,12 +1125,12 @@ class FormatLiteral extends Literal {
11251125
exists(int dot, int afterdot |
11261126
(if this.getPrecision(n) = 0 then dot = 0 else dot = 1) and
11271127
(
1128-
(
1129-
if this.hasExplicitPrecision(n)
1130-
then afterdot = this.getPrecision(n)
1131-
else not this.hasImplicitPrecision(n)
1132-
) and
1133-
afterdot = 6
1128+
if this.hasExplicitPrecision(n)
1129+
then afterdot = this.getPrecision(n)
1130+
else (
1131+
not this.hasImplicitPrecision(n) and
1132+
afterdot = 6
1133+
)
11341134
) and
11351135
len = 1 + 309 + dot + afterdot
11361136
) and
@@ -1140,12 +1140,12 @@ class FormatLiteral extends Literal {
11401140
exists(int dot, int afterdot |
11411141
(if this.getPrecision(n) = 0 then dot = 0 else dot = 1) and
11421142
(
1143-
(
1144-
if this.hasExplicitPrecision(n)
1145-
then afterdot = this.getPrecision(n)
1146-
else not this.hasImplicitPrecision(n)
1147-
) and
1148-
afterdot = 6
1143+
if this.hasExplicitPrecision(n)
1144+
then afterdot = this.getPrecision(n)
1145+
else (
1146+
not this.hasImplicitPrecision(n) and
1147+
afterdot = 6
1148+
)
11491149
) and
11501150
len = 1 + 1 + dot + afterdot + 1 + 1 + 3
11511151
) and
@@ -1155,12 +1155,12 @@ class FormatLiteral extends Literal {
11551155
exists(int dot, int afterdot |
11561156
(if this.getPrecision(n) = 0 then dot = 0 else dot = 1) and
11571157
(
1158-
(
1159-
if this.hasExplicitPrecision(n)
1160-
then afterdot = this.getPrecision(n)
1161-
else not this.hasImplicitPrecision(n)
1162-
) and
1163-
afterdot = 6
1158+
if this.hasExplicitPrecision(n)
1159+
then afterdot = this.getPrecision(n)
1160+
else (
1161+
not this.hasImplicitPrecision(n) and
1162+
afterdot = 6
1163+
)
11641164
) and
11651165
// note: this could be displayed in the style %e or %f;
11661166
// however %f is only used when 'P > X >= -4'

cpp/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ abstract class InlineExpectationsTest extends string {
137137
final predicate hasFailureMessage(FailureLocatable element, string message) {
138138
exists(ActualResult actualResult |
139139
actualResult.getTest() = this and
140+
actualResult.getTag() = this.getARelevantTag() and
140141
element = actualResult and
141142
(
142143
exists(FalseNegativeExpectation falseNegative |
@@ -150,9 +151,18 @@ abstract class InlineExpectationsTest extends string {
150151
)
151152
)
152153
or
154+
exists(ActualResult actualResult |
155+
actualResult.getTest() = this and
156+
not actualResult.getTag() = this.getARelevantTag() and
157+
element = actualResult and
158+
message =
159+
"Tag mismatch: Actual result with tag '" + actualResult.getTag() +
160+
"' that is not part of getARelevantTag()"
161+
)
162+
or
153163
exists(ValidExpectation expectation |
154164
not exists(ActualResult actualResult | expectation.matchesActualResult(actualResult)) and
155-
expectation.getTag() = getARelevantTag() and
165+
expectation.getTag() = this.getARelevantTag() and
156166
element = expectation and
157167
(
158168
expectation instanceof GoodExpectation and
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
typedef void *va_list;
3+
4+
int myPrintf(const char *format, ...) __attribute__((format(printf, 1, 2)));
5+
int mySprintf(char *buffer, const char *format, ...) __attribute__((format(__printf__, 2, 3)));
6+
int myVprintf(const char *format, va_list arg) __attribute__((format(printf, 1, 0)));
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| AttributeFormattingFunction.cpp:4:5:4:12 | myPrintf | 0 | char | wchar_t | wchar_t |
2+
| AttributeFormattingFunction.cpp:5:5:5:13 | mySprintf | 1 | char | wchar_t | wchar_t |

0 commit comments

Comments
 (0)