Skip to content

Commit 7169c4b

Browse files
committed
C++: Another attempt to make the fix more solid. I believe it can't produce negative numbers now.
1 parent 998bec1 commit 7169c4b

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

cpp/ql/lib/semmle/code/cpp/commons/Buffer.qll

+1-6
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,7 @@ private int getSize(VariableAccess va) {
9292
// buffer is `12 - 4 = 8`.
9393
c = getRootType(va) and
9494
// we calculate the size based on the last field, to avoid including any padding after it
95-
trueSize =
96-
max(Field f |
97-
f.getDeclaringType*() = c
98-
|
99-
f.getOffsetInClass(c) + f.getUnspecifiedType().getSize()
100-
) and
95+
trueSize = max(Field f | | f.getOffsetInClass(c) + f.getUnspecifiedType().getSize()) and
10196
result = trueSize - v.(Field).getOffsetInClass(c)
10297
)
10398
)

0 commit comments

Comments
 (0)