Skip to content

Commit a8241f3

Browse files
committed
do not perform shift if negative value
1 parent b856407 commit a8241f3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/astutils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ bool isOperationResultWithinIntRange(const Token* op, const Settings& settings,
10031003
return false;
10041004

10051005
// Leftshift with negative values is undefined behavior.
1006-
if ((rightRange->first < 0) || rightRange->second < 0)
1006+
if ((rightRange->first < 0) || (rightRange->second < 0) || (leftRange->first < 0) || (leftRange->second < 0))
10071007
return false;
10081008

10091009
return checkAllRangeOperations(*leftRange, *rightRange, settings,

0 commit comments

Comments
 (0)