Skip to content

Commit

Permalink
apply check suggested in BehaviorTree#924
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Feb 5, 2025
1 parent 8c83f4d commit 370133e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/behaviortree_cpp/scripting/operators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ struct ExprUnaryArithmetic : ExprBase
case negate:
return Any(-rv);
case complement:
if(rv > static_cast<double>(std::numeric_limits<int64_t>::max()) ||
rv < static_cast<double>(std::numeric_limits<int64_t>::min()))
{
throw RuntimeError("Number out of range for bitwise operation");
}
return Any(static_cast<double>(~static_cast<int64_t>(rv)));
case logical_not:
return Any(static_cast<double>(!static_cast<bool>(rv)));
Expand Down

0 comments on commit 370133e

Please sign in to comment.