Skip to content

Commit 370133e

Browse files
committedFeb 5, 2025
apply check suggested in #924
1 parent 8c83f4d commit 370133e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎include/behaviortree_cpp/scripting/operators.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ struct ExprUnaryArithmetic : ExprBase
129129
case negate:
130130
return Any(-rv);
131131
case complement:
132+
if(rv > static_cast<double>(std::numeric_limits<int64_t>::max()) ||
133+
rv < static_cast<double>(std::numeric_limits<int64_t>::min()))
134+
{
135+
throw RuntimeError("Number out of range for bitwise operation");
136+
}
132137
return Any(static_cast<double>(~static_cast<int64_t>(rv)));
133138
case logical_not:
134139
return Any(static_cast<double>(!static_cast<bool>(rv)));

0 commit comments

Comments
 (0)