Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 1e0b9cc

Browse files
committed
Address review comments 5
1 parent c7a8730 commit 1e0b9cc

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

ql/src/Security/CWE-681/IncorrectIntegerConversion.ql

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,11 @@ class ConversionWithoutBoundsCheckConfig extends TaintTracking::Configuration {
8787
or
8888
// If we are reading a variable, check if it is
8989
// `strconv.IntSize`, and use 0 if it is.
90-
if
91-
exists(StrConv::IntSize intSize |
92-
ip.getTargetBitSizeInput().getNode(c).(DataFlow::ReadNode).reads(intSize)
93-
)
94-
then bitSize = 0
95-
else bitSize = ip.getTargetBitSizeInput().getNode(c).getIntValue()
90+
exists(DataFlow::Node rawBitSize | rawBitSize = ip.getTargetBitSizeInput().getNode(c) |
91+
if rawBitSize = any(StrConv::IntSize intSize).getARead()
92+
then bitSize = 0
93+
else bitSize = rawBitSize.getIntValue()
94+
)
9695
) and
9796
// `bitSize` could be any value between 0 and 64, but we can round
9897
// it up to the nearest size of an integer type without changing

0 commit comments

Comments
 (0)