Skip to content

Commit 417424a

Browse files
committed
C++: Add QLDoc and fix comment in isArray (review comments)
1 parent f025d09 commit 417424a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cpp/ql/src/semmle/code/cpp/models/implementations/SmartPointer.qll

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import semmle.code.cpp.models.interfaces.Taint
22

3+
/**
4+
* The `std::shared_ptr` and `std::unique_ptr` template classes.
5+
*/
36
class UniqueOrSharedPtr extends Class {
47
UniqueOrSharedPtr() { this.hasQualifiedName("std", ["shared_ptr", "unique_ptr"]) }
58
}
69

10+
/**
11+
* The `std::make_shared` and `std::make_unique` template functions.
12+
*/
713
class MakeUniqueOrShared extends TaintFunction {
814
MakeUniqueOrShared() { this.hasQualifiedName("std", ["make_shared", "make_unique"]) }
915

1016
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
11-
// Exclude the `template<class T> shared_ptr<T[]> make_shared(std::size_t)` specialization
12-
// since we don't want to propagate taint via the size of the allocation.
17+
// Exclude the specializations of `std::make_shared` and `std::make_unique` that allocate arrays
18+
// since these just take a size argument, which we don't want to propagate taint through.
1319
not this.isArray() and
1420
input.isParameter(_) and
1521
output.isReturnValue()

0 commit comments

Comments
 (0)