| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…ck (#3143) Fix #2898. __check_double_range accepted +inf, -inf, and NaN for a declared floating_point_range. Two causes: 1. The boundary fast path used __are_doubles_equal, whose ULP-tolerance arithmetic degenerates on non-finite operands (e.g. it claims +inf equals any finite boundary), so +inf and -inf slipped past. 2. The bound check (value < from) || (value > to) is false on both sides for NaN, so NaN slipped past. Fix: - Guard __are_doubles_equal: if either operand is non-finite, fall back to exact ==. - Rewrite the bound check as !(value >= from && value <= to), which rejects NaN. Adds a regression test for +inf, -inf, and NaN. Signed-off-by: Bar <bartalor@gmail.com> (cherry picked from commit fa8478f) # Conflicts: # rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp # rclcpp/test/rclcpp/test_node.cpp
|
Cherry-pick of fa8478f has failed: On branch mergify/bp/kilted/pr-3143 Your branch is up to date with 'origin/kilted'. You are currently cherry-picking commit fa8478f. (fix conflicts and run "git cherry-pick --continue") (use "git cherry-pick --skip" to skip this patch) (use "git cherry-pick --abort" to cancel the cherry-pick operation) Unmerged paths: (use "git add <file>..." to mark resolution) both modified: rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp both modified: rclcpp/test/rclcpp/test_node.cpp no changes added to commit (use "git add" and/or "git commit -a") To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
|
Tick the box to add this pull request to the merge queue (same as @mergifyio queue).
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
Fixes #2898. __check_double_range accepted +inf, -inf, and NaN for parameters declared with a floating_point_range. Fix guards __are_doubles_equal against non-finite operands and rewrites the bound check so NaN is rejected.
Is this user-facing behavior change?
Yes. set_parameter with +inf, -inf, or NaN on a parameter with a floating_point_range now returns successful=false.
Did you use Generative AI?
Yes — Claude Opus 4.7.
Additional Information
Adds a regression test in test_node.cpp for the three non-finite cases. The new scope block pushes the existing TEST_F over cpplint's 800-line limit, so a // NOLINT(readability/fn_size) is added on its closing brace — same pattern other ROS 2 packages use for this case.
This is an automatic backport of pull request #3143 done by [Mergify](https://mergify.com).