Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitf6a9d30

Browse files
committed
A18-1-4: Address compiler compatibility issue
libc++ defines release inline in the header, which causes extraneous paths tobe reported by CodeQL. Adjust to summarize and exclude.
1 parent14e4193 commitf6a9d30

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

‎cpp/autosar/src/rules/A18-1-4/PointerToAnElementOfAnArrayPassedToASmartPointer.ql‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,24 @@ class SingleObjectSmartPointerArrayConstructionConfig extends TaintTracking::Con
5050
)
5151
)
5252
}
53+
54+
overridepredicateisAdditionalTaintStep(DataFlow::Nodesource, DataFlow::Nodesink){
55+
exists(AutosarUniquePointersp,FunctionCallfc|
56+
fc=sp.getAReleaseCall()and
57+
source.asExpr()=fc.getQualifier()and
58+
sink.asExpr()=fc
59+
)
60+
}
61+
62+
overridepredicateisSanitizerIn(DataFlow::Nodenode){
63+
// Exclude flow into header files outside the source archive which are summarized by the
64+
// additional taint steps above.
65+
exists(AutosarUniquePointersp|
66+
sp.getAReleaseCall().getTarget()=node.asExpr().(ThisExpr).getEnclosingFunction()
67+
|
68+
notexists(node.getLocation().getFile().getRelativePath())
69+
)
70+
}
5371
}
5472

5573
from

‎cpp/common/src/codingstandards/cpp/SmartPointers.qll‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ abstract class AutosarSmartPointer extends Class {
7070

7171
classAutosarUniquePointerextendsAutosarSmartPointer{
7272
AutosarUniquePointer(){this.hasQualifiedName("std","unique_ptr")}
73+
74+
FunctionCallgetAReleaseCall(){
75+
result.getTarget().hasName("release")and
76+
result.getQualifier().getType().stripType()=this
77+
}
7378
}
7479

7580
classAutosarSharedPointerextendsAutosarSmartPointer{

‎cpp/common/test/includes/standard-library/memory.h‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,20 @@ template <class T, class D> class unique_ptr<T[], D> {
5757
pointerget()constnoexcept;
5858
explicitoperatorbool()constnoexcept;
5959

60-
pointerrelease()noexcept;
60+
pointerrelease()noexcept {
61+
pointer __p =get();
62+
_M_p =pointer();
63+
return __p;
64+
}
6165
voidreset(pointer p = pointer())noexcept;
6266
voidreset(nullptr_t)noexcept;
6367
template<classU>voidreset(U) = delete;
6468
voidswap(unique_ptr &u)noexcept;
6569
unique_ptr(const unique_ptr &) =delete;
6670
unique_ptr &operator=(const unique_ptr &) =delete;
71+
72+
private:
73+
pointer _M_p;
6774
};
6875

6976
template<classT,class... Args> unique_ptr<T>make_unique(Args &&...args);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp