Skip to content

Commit 82d0551

Browse files
authored
Merge branch 'main' into MybatisSqli
2 parents d2140eb + b5e2e1e commit 82d0551

File tree

41 files changed

+269
-395
lines changed

Some content is hidden

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

41 files changed

+269
-395
lines changed

.github/workflows/mad_modelDiff.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
branches:
1212
- main
1313
paths:
14-
- "java/ql/src/utils/model-generator/**/*.*"
14+
# - "java/ql/src/utils/model-generator/**/*.*"
1515
- ".github/workflows/mad_modelDiff.yml"
1616

1717
permissions:
@@ -61,8 +61,8 @@ jobs:
6161
DATABASE=$2
6262
cd codeql-$QL_VARIANT
6363
SHORTNAME=`basename $DATABASE`
64-
python java/ql/src/utils/model-generator/GenerateFlowModel.py --with-summaries --with-sinks $DATABASE $MODELS/${SHORTNAME}.qll
65-
mv $MODELS/${SHORTNAME}.qll $MODELS/${SHORTNAME}Generated_${QL_VARIANT}.qll
64+
python java/ql/src/utils/model-generator/GenerateFlowModel.py --with-summaries --with-sinks $DATABASE $MODELS/${SHORTNAME}.model.yml
65+
mv $MODELS/${SHORTNAME}.model.yml $MODELS/${SHORTNAME}Generated_${QL_VARIANT}.model.yml
6666
cd ..
6767
}
6868
@@ -85,16 +85,16 @@ jobs:
8585
set -x
8686
MODELS=`pwd`/tmp-models
8787
ls -1 tmp-models/
88-
for m in $MODELS/*_main.qll ; do
88+
for m in $MODELS/*_main.model.yml ; do
8989
t="${m/main/"pr"}"
9090
basename=`basename $m`
91-
name="diff_${basename/_main.qll/""}"
91+
name="diff_${basename/_main.model.yml/""}"
9292
(diff -w -u $m $t | diff2html -i stdin -F $MODELS/$name.html) || true
9393
done
9494
- uses: actions/upload-artifact@v3
9595
with:
9696
name: models
97-
path: tmp-models/*.qll
97+
path: tmp-models/*.model.yml
9898
retention-days: 20
9999
- uses: actions/upload-artifact@v3
100100
with:

.github/workflows/mad_regenerate-models.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
java/ql/src/utils/model-generator/RegenerateModels.py "${SLUG}" dbs/${SHORTNAME}
5454
- name: Stage changes
5555
run: |
56-
find java -name "*.qll" -print0 | xargs -0 git add
56+
find java -name "*.model.yml" -print0 | xargs -0 git add
5757
git status
5858
git diff --cached > models.patch
5959
- uses: actions/upload-artifact@v3

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,4 +244,20 @@ module Consistency {
244244
not callable = viableCallable(call) and
245245
not any(ConsistencyConfiguration c).viableImplInCallContextTooLargeExclude(call, ctx, callable)
246246
}
247+
248+
query predicate uniqueParameterNodeAtPosition(
249+
DataFlowCallable c, ParameterPosition pos, Node p, string msg
250+
) {
251+
isParameterNode(p, c, pos) and
252+
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
253+
msg = "Parameters with overlapping positions."
254+
}
255+
256+
query predicate uniqueParameterNodePosition(
257+
DataFlowCallable c, ParameterPosition pos, Node p, string msg
258+
) {
259+
isParameterNode(p, c, pos) and
260+
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
261+
msg = "Parameter node with multiple positions."
262+
}
247263
}

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,4 +244,20 @@ module Consistency {
244244
not callable = viableCallable(call) and
245245
not any(ConsistencyConfiguration c).viableImplInCallContextTooLargeExclude(call, ctx, callable)
246246
}
247+
248+
query predicate uniqueParameterNodeAtPosition(
249+
DataFlowCallable c, ParameterPosition pos, Node p, string msg
250+
) {
251+
isParameterNode(p, c, pos) and
252+
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
253+
msg = "Parameters with overlapping positions."
254+
}
255+
256+
query predicate uniqueParameterNodePosition(
257+
DataFlowCallable c, ParameterPosition pos, Node p, string msg
258+
) {
259+
isParameterNode(p, c, pos) and
260+
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
261+
msg = "Parameter node with multiple positions."
262+
}
247263
}

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,4 +244,20 @@ module Consistency {
244244
not callable = viableCallable(call) and
245245
not any(ConsistencyConfiguration c).viableImplInCallContextTooLargeExclude(call, ctx, callable)
246246
}
247+
248+
query predicate uniqueParameterNodeAtPosition(
249+
DataFlowCallable c, ParameterPosition pos, Node p, string msg
250+
) {
251+
isParameterNode(p, c, pos) and
252+
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
253+
msg = "Parameters with overlapping positions."
254+
}
255+
256+
query predicate uniqueParameterNodePosition(
257+
DataFlowCallable c, ParameterPosition pos, Node p, string msg
258+
) {
259+
isParameterNode(p, c, pos) and
260+
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
261+
msg = "Parameter node with multiple positions."
262+
}
247263
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,5 @@ postWithInFlow
9393
| test.cpp:499:4:499:4 | p [inner post update] | PostUpdateNode should not be the target of local flow. |
9494
| test.cpp:505:35:505:35 | x [inner post update] | PostUpdateNode should not be the target of local flow. |
9595
viableImplInCallContextTooLarge
96+
uniqueParameterNodeAtPosition
97+
uniqueParameterNodePosition

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,3 +637,5 @@ postWithInFlow
637637
| true_upon_entry.cpp:101:18:101:18 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |
638638
| true_upon_entry.cpp:102:5:102:5 | x [post update] | PostUpdateNode should not be the target of local flow. |
639639
viableImplInCallContextTooLarge
640+
uniqueParameterNodeAtPosition
641+
uniqueParameterNodePosition

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,5 @@ postWithInFlow
158158
| struct_init.c:24:11:24:12 | ab [inner post update] | PostUpdateNode should not be the target of local flow. |
159159
| struct_init.c:36:17:36:24 | nestedAB [inner post update] | PostUpdateNode should not be the target of local flow. |
160160
viableImplInCallContextTooLarge
161+
uniqueParameterNodeAtPosition
162+
uniqueParameterNodePosition

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,3 +1326,5 @@ postWithInFlow
13261326
| struct_init.c:46:16:46:24 | pointerAB [post update] | PostUpdateNode should not be the target of local flow. |
13271327
| struct_init.c:46:16:46:24 | pointerAB [post update] | PostUpdateNode should not be the target of local flow. |
13281328
viableImplInCallContextTooLarge
1329+
uniqueParameterNodeAtPosition
1330+
uniqueParameterNodePosition

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,5 @@ postWithInFlow
127127
| static_init_templates.cpp:21:2:21:4 | val [post update] | PostUpdateNode should not be the target of local flow. |
128128
| try_catch.cpp:7:8:7:8 | call to exception | PostUpdateNode should not be the target of local flow. |
129129
viableImplInCallContextTooLarge
130+
uniqueParameterNodeAtPosition
131+
uniqueParameterNodePosition

0 commit comments

Comments
 (0)