Skip to content

Commit 4a12777

Browse files
committed
Go: convert IncorrectIntegerConversion tests to multiple .qlrefs
1 parent cd59b2c commit 4a12777

15 files changed

+50
-26
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#select
2+
edges
3+
nodes
4+
subpaths
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#select
2+
| Test64BitArchitectureBuildConstraintInFileName_amd64.go:23:7:23:17 | type conversion | Test64BitArchitectureBuildConstraintInFileName_amd64.go:19:3:19:50 | ... := ...[0] | Test64BitArchitectureBuildConstraintInFileName_amd64.go:23:11:23:16 | parsed | Incorrect conversion of an unsigned 64-bit integer from $@ to a lower bit size type int without an upper bound check. | Test64BitArchitectureBuildConstraintInFileName_amd64.go:19:3:19:50 | ... := ...[0] | strconv.ParseUint |
3+
| Test64BitArchitectureBuildConstraints.go:26:7:26:17 | type conversion | Test64BitArchitectureBuildConstraints.go:22:3:22:50 | ... := ...[0] | Test64BitArchitectureBuildConstraints.go:26:11:26:16 | parsed | Incorrect conversion of an unsigned 64-bit integer from $@ to a lower bit size type int without an upper bound check. | Test64BitArchitectureBuildConstraints.go:22:3:22:50 | ... := ...[0] | strconv.ParseUint |
4+
| TestOldBuildConstraints.go:27:7:27:17 | type conversion | TestOldBuildConstraints.go:23:3:23:50 | ... := ...[0] | TestOldBuildConstraints.go:27:11:27:16 | parsed | Incorrect conversion of an unsigned 64-bit integer from $@ to a lower bit size type int without an upper bound check. | TestOldBuildConstraints.go:23:3:23:50 | ... := ...[0] | strconv.ParseUint |
5+
edges
6+
| Test64BitArchitectureBuildConstraintInFileName_amd64.go:19:3:19:50 | ... := ...[0] | Test64BitArchitectureBuildConstraintInFileName_amd64.go:23:11:23:16 | parsed | provenance | |
7+
| Test64BitArchitectureBuildConstraints.go:22:3:22:50 | ... := ...[0] | Test64BitArchitectureBuildConstraints.go:26:11:26:16 | parsed | provenance | |
8+
| TestOldBuildConstraints.go:23:3:23:50 | ... := ...[0] | TestOldBuildConstraints.go:27:11:27:16 | parsed | provenance | |
9+
nodes
10+
| Test64BitArchitectureBuildConstraintInFileName_amd64.go:19:3:19:50 | ... := ...[0] | semmle.label | ... := ...[0] |
11+
| Test64BitArchitectureBuildConstraintInFileName_amd64.go:23:11:23:16 | parsed | semmle.label | parsed |
12+
| Test64BitArchitectureBuildConstraints.go:22:3:22:50 | ... := ...[0] | semmle.label | ... := ...[0] |
13+
| Test64BitArchitectureBuildConstraints.go:26:11:26:16 | parsed | semmle.label | parsed |
14+
| TestOldBuildConstraints.go:23:3:23:50 | ... := ...[0] | semmle.label | ... := ...[0] |
15+
| TestOldBuildConstraints.go:27:11:27:16 | parsed | semmle.label | parsed |
16+
subpaths
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
query: Security/CWE-681/IncorrectIntegerConversionQuery.ql
2+
postprocess:
3+
- utils/test/PrettyPrintModels.ql
4+
- utils/test/InlineExpectationsTestQuery.ql

go/ql/test/query-tests/Security/CWE-681/IncorrectIntegerConversion.expected renamed to go/ql/test/query-tests/Security/CWE-681/IncorrectIntegerConversions/IncorrectIntegerConversion.expected

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,6 @@
144144
| IncorrectIntegerConversion.go:528:7:528:25 | type conversion | IncorrectIntegerConversion.go:513:2:513:38 | ... := ...[0] | IncorrectIntegerConversion.go:528:12:528:24 | type assertion | Incorrect conversion of a signed 64-bit integer from $@ to a lower bit size type int8 without an upper bound check. | IncorrectIntegerConversion.go:513:2:513:38 | ... := ...[0] | strconv.ParseInt |
145145
| IncorrectIntegerConversion.go:538:7:538:13 | type conversion | IncorrectIntegerConversion.go:533:2:533:38 | ... := ...[0] | IncorrectIntegerConversion.go:538:12:538:12 | v | Incorrect conversion of a signed 64-bit integer from $@ to a lower bit size type int8 without an upper bound check. | IncorrectIntegerConversion.go:533:2:533:38 | ... := ...[0] | strconv.ParseInt |
146146
| IncorrectIntegerConversion.go:540:7:540:14 | type conversion | IncorrectIntegerConversion.go:533:2:533:38 | ... := ...[0] | IncorrectIntegerConversion.go:540:13:540:13 | v | Incorrect conversion of a signed 64-bit integer from $@ to a lower bit size type int16 without an upper bound check. | IncorrectIntegerConversion.go:533:2:533:38 | ... := ...[0] | strconv.ParseInt |
147-
| Test64BitArchitectureBuildConstraintInFileName_amd64.go:23:7:23:17 | type conversion | Test64BitArchitectureBuildConstraintInFileName_amd64.go:19:3:19:50 | ... := ...[0] | Test64BitArchitectureBuildConstraintInFileName_amd64.go:23:11:23:16 | parsed | Incorrect conversion of an unsigned 64-bit integer from $@ to a lower bit size type int without an upper bound check. | Test64BitArchitectureBuildConstraintInFileName_amd64.go:19:3:19:50 | ... := ...[0] | strconv.ParseUint |
148-
| Test64BitArchitectureBuildConstraints.go:26:7:26:17 | type conversion | Test64BitArchitectureBuildConstraints.go:22:3:22:50 | ... := ...[0] | Test64BitArchitectureBuildConstraints.go:26:11:26:16 | parsed | Incorrect conversion of an unsigned 64-bit integer from $@ to a lower bit size type int without an upper bound check. | Test64BitArchitectureBuildConstraints.go:22:3:22:50 | ... := ...[0] | strconv.ParseUint |
149-
| TestNoArchitectureBuildConstraints.go:16:7:16:19 | type conversion | TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:16:13:16:18 | parsed | Incorrect conversion of an integer with architecture-dependent bit size from $@ to a lower bit size type int32 without an upper bound check. | TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | strconv.ParseInt |
150-
| TestNoArchitectureBuildConstraints.go:17:7:17:20 | type conversion | TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:17:14:17:19 | parsed | Incorrect conversion of an integer with architecture-dependent bit size from $@ to a lower bit size type uint32 without an upper bound check. | TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | strconv.ParseInt |
151-
| TestNoArchitectureBuildConstraints.go:24:7:24:17 | type conversion | TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:24:11:24:16 | parsed | Incorrect conversion of a signed 64-bit integer from $@ to a lower bit size type int without an upper bound check. | TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | strconv.ParseInt |
152-
| TestNoArchitectureBuildConstraints.go:25:7:25:18 | type conversion | TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:25:12:25:17 | parsed | Incorrect conversion of a signed 64-bit integer from $@ to a lower bit size type uint without an upper bound check. | TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | strconv.ParseInt |
153-
| TestOldBuildConstraints.go:27:7:27:17 | type conversion | TestOldBuildConstraints.go:23:3:23:50 | ... := ...[0] | TestOldBuildConstraints.go:27:11:27:16 | parsed | Incorrect conversion of an unsigned 64-bit integer from $@ to a lower bit size type int without an upper bound check. | TestOldBuildConstraints.go:23:3:23:50 | ... := ...[0] | strconv.ParseUint |
154147
edges
155148
| IncorrectIntegerConversion.go:27:2:27:28 | ... := ...[0] | IncorrectIntegerConversion.go:36:47:36:49 | num | provenance | |
156149
| IncorrectIntegerConversion.go:66:3:66:49 | ... := ...[0] | IncorrectIntegerConversion.go:70:12:70:17 | parsed | provenance | |
@@ -321,13 +314,6 @@ edges
321314
| IncorrectIntegerConversion.go:534:6:534:10 | definition of input | IncorrectIntegerConversion.go:539:21:539:25 | input | provenance | Config |
322315
| IncorrectIntegerConversion.go:535:14:535:18 | input | IncorrectIntegerConversion.go:538:12:538:12 | v | provenance | |
323316
| IncorrectIntegerConversion.go:539:21:539:25 | input | IncorrectIntegerConversion.go:540:13:540:13 | v | provenance | |
324-
| Test64BitArchitectureBuildConstraintInFileName_amd64.go:19:3:19:50 | ... := ...[0] | Test64BitArchitectureBuildConstraintInFileName_amd64.go:23:11:23:16 | parsed | provenance | |
325-
| Test64BitArchitectureBuildConstraints.go:22:3:22:50 | ... := ...[0] | Test64BitArchitectureBuildConstraints.go:26:11:26:16 | parsed | provenance | |
326-
| TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:16:13:16:18 | parsed | provenance | |
327-
| TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:17:14:17:19 | parsed | provenance | |
328-
| TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:24:11:24:16 | parsed | provenance | |
329-
| TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:25:12:25:17 | parsed | provenance | |
330-
| TestOldBuildConstraints.go:23:3:23:50 | ... := ...[0] | TestOldBuildConstraints.go:27:11:27:16 | parsed | provenance | |
331317
nodes
332318
| IncorrectIntegerConversion.go:27:2:27:28 | ... := ...[0] | semmle.label | ... := ...[0] |
333319
| IncorrectIntegerConversion.go:36:47:36:49 | num | semmle.label | num |
@@ -528,16 +514,4 @@ nodes
528514
| IncorrectIntegerConversion.go:538:12:538:12 | v | semmle.label | v |
529515
| IncorrectIntegerConversion.go:539:21:539:25 | input | semmle.label | input |
530516
| IncorrectIntegerConversion.go:540:13:540:13 | v | semmle.label | v |
531-
| Test64BitArchitectureBuildConstraintInFileName_amd64.go:19:3:19:50 | ... := ...[0] | semmle.label | ... := ...[0] |
532-
| Test64BitArchitectureBuildConstraintInFileName_amd64.go:23:11:23:16 | parsed | semmle.label | parsed |
533-
| Test64BitArchitectureBuildConstraints.go:22:3:22:50 | ... := ...[0] | semmle.label | ... := ...[0] |
534-
| Test64BitArchitectureBuildConstraints.go:26:11:26:16 | parsed | semmle.label | parsed |
535-
| TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | semmle.label | ... := ...[0] |
536-
| TestNoArchitectureBuildConstraints.go:16:13:16:18 | parsed | semmle.label | parsed |
537-
| TestNoArchitectureBuildConstraints.go:17:14:17:19 | parsed | semmle.label | parsed |
538-
| TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | semmle.label | ... := ...[0] |
539-
| TestNoArchitectureBuildConstraints.go:24:11:24:16 | parsed | semmle.label | parsed |
540-
| TestNoArchitectureBuildConstraints.go:25:12:25:17 | parsed | semmle.label | parsed |
541-
| TestOldBuildConstraints.go:23:3:23:50 | ... := ...[0] | semmle.label | ... := ...[0] |
542-
| TestOldBuildConstraints.go:27:11:27:16 | parsed | semmle.label | parsed |
543517
subpaths
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
query: Security/CWE-681/IncorrectIntegerConversionQuery.ql
2+
postprocess:
3+
- utils/test/PrettyPrintModels.ql
4+
- utils/test/InlineExpectationsTestQuery.ql
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#select
2+
| TestNoArchitectureBuildConstraints.go:16:7:16:19 | type conversion | TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:16:13:16:18 | parsed | Incorrect conversion of an integer with architecture-dependent bit size from $@ to a lower bit size type int32 without an upper bound check. | TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | strconv.ParseInt |
3+
| TestNoArchitectureBuildConstraints.go:17:7:17:20 | type conversion | TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:17:14:17:19 | parsed | Incorrect conversion of an integer with architecture-dependent bit size from $@ to a lower bit size type uint32 without an upper bound check. | TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | strconv.ParseInt |
4+
| TestNoArchitectureBuildConstraints.go:24:7:24:17 | type conversion | TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:24:11:24:16 | parsed | Incorrect conversion of a signed 64-bit integer from $@ to a lower bit size type int without an upper bound check. | TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | strconv.ParseInt |
5+
| TestNoArchitectureBuildConstraints.go:25:7:25:18 | type conversion | TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:25:12:25:17 | parsed | Incorrect conversion of a signed 64-bit integer from $@ to a lower bit size type uint without an upper bound check. | TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | strconv.ParseInt |
6+
edges
7+
| TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:16:13:16:18 | parsed | provenance | |
8+
| TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:17:14:17:19 | parsed | provenance | |
9+
| TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:24:11:24:16 | parsed | provenance | |
10+
| TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | TestNoArchitectureBuildConstraints.go:25:12:25:17 | parsed | provenance | |
11+
nodes
12+
| TestNoArchitectureBuildConstraints.go:12:3:12:48 | ... := ...[0] | semmle.label | ... := ...[0] |
13+
| TestNoArchitectureBuildConstraints.go:16:13:16:18 | parsed | semmle.label | parsed |
14+
| TestNoArchitectureBuildConstraints.go:17:14:17:19 | parsed | semmle.label | parsed |
15+
| TestNoArchitectureBuildConstraints.go:20:3:20:49 | ... := ...[0] | semmle.label | ... := ...[0] |
16+
| TestNoArchitectureBuildConstraints.go:24:11:24:16 | parsed | semmle.label | parsed |
17+
| TestNoArchitectureBuildConstraints.go:25:12:25:17 | parsed | semmle.label | parsed |
18+
subpaths
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
query: Security/CWE-681/IncorrectIntegerConversionQuery.ql
2+
postprocess:
3+
- utils/test/PrettyPrintModels.ql
4+
- utils/test/InlineExpectationsTestQuery.ql

0 commit comments

Comments
 (0)