Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 69b283e

Browse filesBrowse files
authored
Merge branch 'main' into dependabot/pip/scripts/pip-c52dbdc267
2 parents 21deab5 + 2526a88 commit 69b283e
Copy full SHA for 69b283e

File tree

254 files changed

+5936
-1605
lines changed
Filter options

Some content is hidden

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

254 files changed

+5936
-1605
lines changed

‎.github/workflows/upgrade_codeql_dependencies.yml

Copy file name to clipboardExpand all lines: .github/workflows/upgrade_codeql_dependencies.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
find c \( -name '*.ql' -or -name '*.qll' \) -print0 | xargs -0 --max-procs "$XARGS_MAX_PROCS" codeql query format --in-place
5454
5555
- name: Create Pull Request
56-
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
56+
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
5757
with:
5858
title: "Upgrade `github/codeql` dependency to ${{ github.event.inputs.codeql_cli_version }}"
5959
body: |

‎amendments.csv

Copy file name to clipboard
+34-33Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,50 @@
11
language,standard,amendment,rule_id,supportable,implementation_category,implemented,difficulty
2-
c,MISRA-C-2012,Amendment3,DIR-4-6,Yes,Expand,No,Easy
2+
c,MISRA-C-2012,Amendment3,DIR-4-6,Yes,Expand,Yes,Easy
33
c,MISRA-C-2012,Amendment3,DIR-4-9,Yes,Refine,No,Easy
44
c,MISRA-C-2012,Amendment3,DIR-4-11,Yes,Refine,No,Import
55
c,MISRA-C-2012,Amendment3,RULE-1-4,Yes,Replace,No,Easy
6-
c,MISRA-C-2012,Amendment3,RULE-10-1,Yes,Replace,No,Easy
7-
c,MISRA-C-2012,Amendment3,RULE-10-3,Yes,Refine,No,Easy
8-
c,MISRA-C-2012,Amendment3,RULE-10-4,Yes,Refine,No,Import
9-
c,MISRA-C-2012,Amendment3,RULE-10-5,Yes,Expand,No,Easy
10-
c,MISRA-C-2012,Amendment3,RULE-10-7,Yes,Refine,No,Import
11-
c,MISRA-C-2012,Amendment3,RULE-10-8,Yes,Refine,No,Import
12-
c,MISRA-C-2012,Amendment3,RULE-21-11,Yes,Clarification,No,Import
6+
c,MISRA-C-2012,Amendment3,RULE-10-1,Yes,Replace,Yes,Easy
7+
c,MISRA-C-2012,Amendment3,RULE-10-3,Yes,Refine,Yes,Easy
8+
c,MISRA-C-2012,Amendment3,RULE-10-4,Yes,Refine,Yes,Import
9+
c,MISRA-C-2012,Amendment3,RULE-10-5,Yes,Expand,Yes,Easy
10+
c,MISRA-C-2012,Amendment3,RULE-10-7,Yes,Refine,Yes,Import
11+
c,MISRA-C-2012,Amendment3,RULE-10-8,Yes,Refine,Yes,Import
12+
c,MISRA-C-2012,Amendment3,RULE-21-11,Yes,Clarification,Yes,Import
1313
c,MISRA-C-2012,Amendment3,RULE-21-12,Yes,Replace,No,Easy
1414
c,MISRA-C-2012,Amendment4,RULE-11-3,Yes,Expand,No,Easy
1515
c,MISRA-C-2012,Amendment4,RULE-11-8,Yes,Expand,No,Easy
1616
c,MISRA-C-2012,Amendment4,RULE-13-2,Yes,Expand,No,Very Hard
1717
c,MISRA-C-2012,Amendment4,RULE-18-6,Yes,Expand,No,Medium
1818
c,MISRA-C-2012,Amendment4,RULE-18-8,Yes,Split,Yes,Easy
19-
c,MISRA-C-2012,Corrigendum2,RULE-2-2,Yes,Clarification,No,Import
20-
c,MISRA-C-2012,Corrigendum2,RULE-2-7,Yes,Clarification,No,Import
21-
c,MISRA-C-2012,Corrigendum2,RULE-3-1,Yes,Refine,No,Easy
22-
c,MISRA-C-2012,Corrigendum2,RULE-8-6,Yes,Clarification,No,Import
23-
c,MISRA-C-2012,Corrigendum2,RULE-8-9,Yes,Clarification,No,Import
24-
c,MISRA-C-2012,Corrigendum2,RULE-9-4,Yes,Clarification,No,Import
25-
c,MISRA-C-2012,Corrigendum2,RULE-10-1,Yes,Clarification,No,Import
26-
c,MISRA-C-2012,Corrigendum2,RULE-18-3,Yes,Clarification,No,Import
27-
c,MISRA-C-2012,Corrigendum2,RULE-1-4,Yes,Replace,No,Easy
28-
c,MISRA-C-2012,Corrigendum2,RULE-9-1,Yes,Refine,No,Easy
29-
c,MISRA-C-2012,Corrigendum2,RULE-9-2,Yes,Refine,No,Import
30-
c,MISRA-C-2012,Corrigendum2,DIR-4-10,Yes,Clarification,No,Import
19+
c,MISRA-C-2012,Amendment4,RULE-2-2,Yes,Clarification,Yes,Import
20+
c,MISRA-C-2012,Amendment4,RULE-2-7,Yes,Clarification,Yes,Import
21+
c,MISRA-C-2012,Amendment4,RULE-3-1,Yes,Refine,No,Easy
22+
c,MISRA-C-2012,Amendment4,RULE-8-6,Yes,Clarification,Yes,Import
23+
c,MISRA-C-2012,Amendment4,RULE-8-9,Yes,Clarification,Yes,Import
24+
c,MISRA-C-2012,Amendment4,RULE-9-4,Yes,Clarification,Yes,Import
25+
c,MISRA-C-2012,Amendment4,RULE-10-1,Yes,Clarification,Yes,Import
26+
c,MISRA-C-2012,Amendment4,RULE-18-3,Yes,Clarification,Yes,Import
27+
c,MISRA-C-2012,Amendment4,RULE-1-4,Yes,Replace,No,Easy
28+
c,MISRA-C-2012,Amendment4,RULE-9-1,Yes,Refine,No,Easy
29+
c,MISRA-C-2012,Amendment4,RULE-9-2,Yes,Refine,No,Import
30+
c,MISRA-C-2012,Corrigendum2,DIR-4-10,Yes,Clarification,Yes,Import
3131
c,MISRA-C-2012,Corrigendum2,RULE-7-4,Yes,Refine,No,Easy
32-
c,MISRA-C-2012,Corrigendum2,RULE-8-2,Yes,Clarification,No,Import
32+
c,MISRA-C-2012,Corrigendum2,RULE-8-2,Yes,Clarification,Yes,Import
3333
c,MISRA-C-2012,Corrigendum2,RULE-8-3,Yes,Refine,No,Easy
34-
c,MISRA-C-2012,Corrigendum2,RULE-8-7,Yes,Clarification,No,Import
34+
c,MISRA-C-2012,Corrigendum2,RULE-8-7,Yes,Clarification,Yes,Import
35+
c,MISRA-C-2012,Corrigendum2,RULE-10-1,Yes,Clarification,Yes,Import
3536
c,MISRA-C-2012,Corrigendum2,RULE-10-2,Yes,Refine,No,Easy
36-
c,MISRA-C-2012,Corrigendum2,RULE-10-3,Yes,Clarification,No,Import
37-
c,MISRA-C-2012,Corrigendum2,RULE-11-3,Yes,Clarification,No,Import
38-
c,MISRA-C-2012,Corrigendum2,RULE-11-6,Yes,Clarification,No,Import
39-
c,MISRA-C-2012,Corrigendum2,RULE-13-2,Yes,Clarification,No,Import
40-
c,MISRA-C-2012,Corrigendum2,RULE-13-6,Yes,Clarification,No,Import
37+
c,MISRA-C-2012,Corrigendum2,RULE-10-3,Yes,Clarification,Yes,Import
38+
c,MISRA-C-2012,Corrigendum2,RULE-11-3,Yes,Clarification,Yes,Import
39+
c,MISRA-C-2012,Corrigendum2,RULE-11-6,Yes,Clarification,Yes,Import
40+
c,MISRA-C-2012,Corrigendum2,RULE-13-2,Yes,Clarification,Yes,Import
41+
c,MISRA-C-2012,Corrigendum2,RULE-13-6,Yes,Clarification,Yes,Import
4142
c,MISRA-C-2012,Corrigendum2,RULE-14-3,Yes,Refine,No,Easy
42-
c,MISRA-C-2012,Corrigendum2,RULE-15-7,Yes,Clarification,No,Import
43-
c,MISRA-C-2012,Corrigendum2,RULE-17-4,Yes,Clarification,No,Import
44-
c,MISRA-C-2012,Corrigendum2,RULE-17-5,Yes,Clarification,No,Import
43+
c,MISRA-C-2012,Corrigendum2,RULE-15-7,Yes,Clarification,Yes,Import
44+
c,MISRA-C-2012,Corrigendum2,RULE-17-4,Yes,Clarification,Yes,Import
45+
c,MISRA-C-2012,Corrigendum2,RULE-17-5,Yes,Clarification,Yes,Import
4546
c,MISRA-C-2012,Corrigendum2,RULE-18-1,Yes,Refine,No,Easy
46-
c,MISRA-C-2012,Corrigendum2,RULE-20-14,No,Clarification,No,Import
47-
c,MISRA-C-2012,Corrigendum2,RULE-21-19,Yes,Clarification,No,Import
47+
c,MISRA-C-2012,Corrigendum2,RULE-20-14,No,Clarification,Yes,Import
48+
c,MISRA-C-2012,Corrigendum2,RULE-21-19,Yes,Clarification,Yes,Import
4849
c,MISRA-C-2012,Corrigendum2,RULE-21-20,Yes,Refine,No,Easy
49-
c,MISRA-C-2012,Corrigendum2,RULE-22-9,Yes,Clarification,No,Import
50+
c,MISRA-C-2012,Corrigendum2,RULE-22-9,Yes,Clarification,Yes,Import

‎c/cert/src/codeql-pack.lock.yml

Copy file name to clipboardExpand all lines: c/cert/src/codeql-pack.lock.yml
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
lockVersion: 1.0.0
33
dependencies:
44
codeql/cpp-all:
5-
version: 1.4.2
5+
version: 2.1.1
66
codeql/dataflow:
7-
version: 1.1.1
7+
version: 1.1.6
88
codeql/mad:
9-
version: 1.0.7
9+
version: 1.0.12
1010
codeql/rangeanalysis:
11-
version: 1.0.7
11+
version: 1.0.12
1212
codeql/ssa:
13-
version: 1.0.7
13+
version: 1.0.12
1414
codeql/tutorial:
15-
version: 1.0.7
15+
version: 1.0.12
1616
codeql/typeflow:
17-
version: 1.0.7
17+
version: 1.0.12
1818
codeql/typetracking:
19-
version: 1.0.7
19+
version: 1.0.12
2020
codeql/util:
21-
version: 1.0.7
21+
version: 1.0.12
2222
codeql/xml:
23-
version: 1.0.7
23+
version: 1.0.12
2424
compiled: false

‎c/cert/src/qlpack.yml

Copy file name to clipboard
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: codeql/cert-c-coding-standards
2-
version: 2.41.0-dev
2+
version: 2.42.0-dev
33
description: CERT C 2016
44
suites: codeql-suites
55
license: MIT
66
dependencies:
77
codeql/common-c-coding-standards: '*'
8-
codeql/cpp-all: 1.4.2
8+
codeql/cpp-all: 2.1.1

‎c/cert/src/rules/CON30-C/CleanUpThreadSpecificStorage.ql

Copy file name to clipboardExpand all lines: c/cert/src/rules/CON30-C/CleanUpThreadSpecificStorage.ql
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import cpp
1616
import codingstandards.c.cert
1717
import codingstandards.cpp.Concurrency
18-
import semmle.code.cpp.dataflow.TaintTracking
1918
import semmle.code.cpp.dataflow.DataFlow
2019

2120
module TssCreateToTssDeleteConfig implements DataFlow::ConfigSig {

‎c/cert/src/rules/CON34-C/AppropriateThreadObjectStorageDurations.ql

Copy file name to clipboardExpand all lines: c/cert/src/rules/CON34-C/AppropriateThreadObjectStorageDurations.ql
+31-18Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,43 @@
1414

1515
import cpp
1616
import codingstandards.c.cert
17+
import codingstandards.c.Objects
1718
import codingstandards.cpp.Concurrency
18-
import semmle.code.cpp.dataflow.TaintTracking
1919
import semmle.code.cpp.dataflow.DataFlow
2020
import semmle.code.cpp.commons.Alloc
2121

22-
from C11ThreadCreateCall tcc, StackVariable sv, Expr arg, Expr acc
22+
from C11ThreadCreateCall tcc, Expr arg
2323
where
2424
not isExcluded(tcc, Concurrency4Package::appropriateThreadObjectStorageDurationsQuery()) and
2525
tcc.getArgument(2) = arg and
26-
sv.getAnAccess() = acc and
27-
// a stack variable that is given as an argument to a thread
28-
TaintTracking::localTaint(DataFlow::exprNode(acc), DataFlow::exprNode(arg)) and
29-
// or isn't one of the allowed usage patterns
30-
not exists(Expr mfc |
31-
isAllocationExpr(mfc) and
32-
sv.getAnAssignedValue() = mfc and
33-
acc.getAPredecessor*() = mfc
34-
) and
35-
not exists(TSSGetFunctionCall tsg, TSSSetFunctionCall tss, DataFlow::Node src |
36-
sv.getAnAssignedValue() = tsg and
37-
acc.getAPredecessor*() = tsg and
38-
// there should be dataflow from somewhere (the same somewhere)
39-
// into each of the first arguments
40-
DataFlow::localFlow(src, DataFlow::exprNode(tsg.getArgument(0))) and
41-
DataFlow::localFlow(src, DataFlow::exprNode(tss.getArgument(0)))
26+
(
27+
exists(ObjectIdentity obj, Expr acc |
28+
obj.getASubobjectAccess() = acc and
29+
obj.getStorageDuration().isAutomatic() and
30+
exists(DataFlow::Node addrNode |
31+
(
32+
addrNode = DataFlow::exprNode(any(AddressOfExpr e | e.getOperand() = acc))
33+
or
34+
addrNode = DataFlow::exprNode(acc) and
35+
exists(ArrayToPointerConversion c | c.getExpr() = acc)
36+
) and
37+
TaintTracking::localTaint(addrNode, DataFlow::exprNode(arg))
38+
)
39+
)
40+
or
41+
// TODO: This case is handling threadlocals in a useful way that's not intended to be covered
42+
// by the rule. See issue #801. The actual rule should expect no tss_t objects is used, and
43+
// this check that this is initialized doesn't seem to belong here. However, it is a useful
44+
// check in and of itself, so we should figure out if this is part of an optional rule we
45+
// haven't yet implemented and move this behavior there.
46+
exists(TSSGetFunctionCall tsg |
47+
TaintTracking::localTaint(DataFlow::exprNode(tsg), DataFlow::exprNode(arg)) and
48+
not exists(TSSSetFunctionCall tss, DataFlow::Node src |
49+
// there should be dataflow from somewhere (the same somewhere)
50+
// into each of the first arguments
51+
DataFlow::localFlow(src, DataFlow::exprNode(tsg.getArgument(0))) and
52+
DataFlow::localFlow(src, DataFlow::exprNode(tss.getArgument(0)))
53+
)
54+
)
4255
)
4356
select tcc, "$@ not declared with appropriate storage duration", arg, "Shared object"

‎c/cert/src/rules/CON34-C/ThreadObjectStorageDurationsNotInitialized.ql

Copy file name to clipboardExpand all lines: c/cert/src/rules/CON34-C/ThreadObjectStorageDurationsNotInitialized.ql
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import cpp
1717
import codingstandards.c.cert
1818
import codingstandards.cpp.Concurrency
19-
import semmle.code.cpp.dataflow.TaintTracking
2019
import semmle.code.cpp.dataflow.DataFlow
2120

2221
from TSSGetFunctionCall tsg, ThreadedFunction tf

‎c/cert/src/rules/CON39-C/ThreadWasPreviouslyJoinedOrDetached.ql

Copy file name to clipboardExpand all lines: c/cert/src/rules/CON39-C/ThreadWasPreviouslyJoinedOrDetached.ql
+6-33Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,10 @@
1414

1515
import cpp
1616
import codingstandards.c.cert
17-
import codingstandards.cpp.Concurrency
17+
import codingstandards.cpp.rules.joinordetachthreadonlyonce.JoinOrDetachThreadOnlyOnce
1818

19-
// OK
20-
// 1) Thread calls detach parent DOES NOT call join
21-
// 2) Parent calls join, thread does NOT call detach()
22-
// NOT OK
23-
// 1) Thread calls detach, parent calls join
24-
// 2) Thread calls detach twice, parent does not call join
25-
// 3) Parent calls join twice, thread does not call detach
26-
from C11ThreadCreateCall tcc
27-
where
28-
not isExcluded(tcc, Concurrency5Package::threadWasPreviouslyJoinedOrDetachedQuery()) and
29-
// Note: These cases can be simplified but they are presented like this for clarity
30-
// case 1 - calls to `thrd_join` and `thrd_detach` within the parent or
31-
// within the parent / child CFG.
32-
exists(C11ThreadWait tw, C11ThreadDetach dt |
33-
tw = getAThreadContextAwareSuccessor(tcc) and
34-
dt = getAThreadContextAwareSuccessor(tcc)
35-
)
36-
or
37-
// case 2 - multiple calls to `thrd_detach` within the threaded CFG.
38-
exists(C11ThreadDetach dt1, C11ThreadDetach dt2 |
39-
dt1 = getAThreadContextAwareSuccessor(tcc) and
40-
dt2 = getAThreadContextAwareSuccessor(tcc) and
41-
not dt1 = dt2
42-
)
43-
or
44-
// case 3 - multiple calls to `thrd_join` within the threaded CFG.
45-
exists(C11ThreadWait tw1, C11ThreadWait tw2 |
46-
tw1 = getAThreadContextAwareSuccessor(tcc) and
47-
tw2 = getAThreadContextAwareSuccessor(tcc) and
48-
not tw1 = tw2
49-
)
50-
select tcc, "Thread may call join or detach after the thread is joined or detached."
19+
class ThreadWasPreviouslyJoinedOrDetachedQuery extends JoinOrDetachThreadOnlyOnceSharedQuery {
20+
ThreadWasPreviouslyJoinedOrDetachedQuery() {
21+
this = Concurrency5Package::threadWasPreviouslyJoinedOrDetachedQuery()
22+
}
23+
}

‎c/cert/src/rules/DCL30-C/AppropriateStorageDurationsFunctionReturn.ql

Copy file name to clipboardExpand all lines: c/cert/src/rules/DCL30-C/AppropriateStorageDurationsFunctionReturn.ql
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@
1313

1414
import cpp
1515
import codingstandards.c.cert
16+
import codingstandards.c.Objects
1617
import semmle.code.cpp.dataflow.DataFlow
1718

18-
class Source extends StackVariable {
19-
Source() { not this instanceof Parameter }
19+
class Source extends Expr {
20+
ObjectIdentity rootObject;
21+
22+
Source() {
23+
rootObject.getStorageDuration().isAutomatic() and
24+
this = rootObject.getASubobjectAddressExpr()
25+
}
2026
}
2127

2228
class Sink extends DataFlow::Node {
@@ -40,7 +46,7 @@ from DataFlow::Node src, DataFlow::Node sink
4046
where
4147
not isExcluded(sink.asExpr(),
4248
Declarations8Package::appropriateStorageDurationsFunctionReturnQuery()) and
43-
exists(Source s | src.asExpr() = s.getAnAccess()) and
49+
exists(Source s | src.asExpr() = s) and
4450
sink instanceof Sink and
4551
DataFlow::localFlow(src, sink)
4652
select sink, "$@ with automatic storage may be accessible outside of its lifetime.", src,

‎c/cert/src/rules/ERR30-C/ErrnoReadBeforeReturn.ql

Copy file name to clipboardExpand all lines: c/cert/src/rules/ERR30-C/ErrnoReadBeforeReturn.ql
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import cpp
1515
import codingstandards.c.cert
1616
import codingstandards.c.Errno
17+
import semmle.code.cpp.dataflow.DataFlow
1718

1819
/**
1920
* A call to an `OutOfBandErrnoSettingFunction`

‎c/cert/src/rules/ERR30-C/FunctionCallBeforeErrnoCheck.ql

Copy file name to clipboardExpand all lines: c/cert/src/rules/ERR30-C/FunctionCallBeforeErrnoCheck.ql
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import cpp
1515
import codingstandards.c.cert
1616
import codingstandards.c.Errno
17-
import semmle.code.cpp.dataflow.DataFlow
1817

1918
/**
2019
* A call to an `OutOfBandErrnoSettingFunction`

‎c/cert/src/rules/ERR30-C/SetlocaleMightSetErrno.ql

Copy file name to clipboardExpand all lines: c/cert/src/rules/ERR30-C/SetlocaleMightSetErrno.ql
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import cpp
1414
import codingstandards.c.cert
1515
import codingstandards.c.Errno
16+
import semmle.code.cpp.dataflow.DataFlow
1617

1718
class SetlocaleFunctionCall extends FunctionCall {
1819
SetlocaleFunctionCall() { this.getTarget().hasGlobalName("setlocale") }

‎c/cert/src/rules/ERR32-C/DoNotRelyOnIndeterminateValuesOfErrno.ql

Copy file name to clipboardExpand all lines: c/cert/src/rules/ERR32-C/DoNotRelyOnIndeterminateValuesOfErrno.ql
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ import semmle.code.cpp.controlflow.Guards
2020
* A check on `signal` call return value
2121
* `if (signal(SIGINT, handler) == SIG_ERR)`
2222
*/
23-
class SignalCheckOperation extends EqualityOperation, GuardCondition {
23+
class SignalCheckOperation extends EqualityOperation instanceof GuardCondition {
2424
BasicBlock errorSuccessor;
2525

2626
SignalCheckOperation() {
2727
this.getAnOperand() = any(MacroInvocation m | m.getMacroName() = "SIG_ERR").getExpr() and
2828
(
2929
this.getOperator() = "==" and
30-
this.controls(errorSuccessor, true)
30+
super.controls(errorSuccessor, true)
3131
or
3232
this.getOperator() = "!=" and
33-
this.controls(errorSuccessor, false)
33+
super.controls(errorSuccessor, false)
3434
)
3535
}
3636

‎c/cert/src/rules/EXP30-C/DependenceOnOrderOfFunctionArgumentsForSideEffects.ql

Copy file name to clipboardExpand all lines: c/cert/src/rules/EXP30-C/DependenceOnOrderOfFunctionArgumentsForSideEffects.ql
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import cpp
1515
import codingstandards.c.cert
1616
import codingstandards.cpp.SideEffect
17-
import semmle.code.cpp.dataflow.DataFlow
1817
import semmle.code.cpp.dataflow.TaintTracking
1918
import semmle.code.cpp.valuenumbering.GlobalValueNumbering
2019

‎c/cert/src/rules/EXP35-C/DoNotModifyObjectsWithTemporaryLifetime.ql

Copy file name to clipboardExpand all lines: c/cert/src/rules/EXP35-C/DoNotModifyObjectsWithTemporaryLifetime.ql
+5-7Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@
1313

1414
import cpp
1515
import codingstandards.c.cert
16-
import codingstandards.cpp.lifetimes.CLifetimes
16+
import codingstandards.c.Objects
1717

1818
// Note: Undefined behavior is possible regardless of whether the accessed field from the returned
1919
// struct is an array or a scalar (i.e. arithmetic and pointer types) member, according to the standard.
20-
from FieldAccess fa, FunctionCall fc
20+
from FieldAccess fa, TemporaryObjectIdentity tempObject
2121
where
2222
not isExcluded(fa, InvalidMemory2Package::doNotModifyObjectsWithTemporaryLifetimeQuery()) and
23-
not fa.getQualifier().isLValue() and
24-
fa.getQualifier().getUnconverted() = fc and
25-
fa.getQualifier().getUnconverted().getUnspecifiedType() instanceof StructOrUnionTypeWithArrayField
26-
select fa, "Field access on $@ qualifier occurs after its temporary object lifetime.", fc,
27-
"function call"
23+
fa.getQualifier().getUnconverted() = tempObject
24+
select fa, "Field access on $@ qualifier occurs after its temporary object lifetime.", tempObject,
25+
"temporary object"

‎c/cert/src/rules/FIO37-C/SuccessfulFgetsOrFgetwsMayReturnAnEmptyString.ql

Copy file name to clipboardExpand all lines: c/cert/src/rules/FIO37-C/SuccessfulFgetsOrFgetwsMayReturnAnEmptyString.ql
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import cpp
1414
import codingstandards.c.cert
1515
import codingstandards.cpp.FgetsErrorManagement
1616
import codingstandards.cpp.Dereferenced
17-
import semmle.code.cpp.dataflow.TaintTracking
17+
import semmle.code.cpp.dataflow.DataFlow
1818

1919
/*
2020
* CFG nodes that follows a successful call to `fgets`

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.