← Back to Pull requests

Fix seg fault in smac planner smoother when checking expansion #6645

Merged
bkrodinger merged 1 files (5 lines) on Nov 17, 2026 19:33 UTC
View on GitHub
bkrodinger bkrodinger commented on Oct 11, 2026 00:40 UTC
Author

---

Basic Info

| Info | Please fill out this column |
| ------ | ----------- |
| Ticket(s) this addresses | |
| Primary OS tested on | Ubuntu Container |
| Robotic platform tested on | on-machine |
| Does this PR contain AI generated software? | No |
| Was this PR description generated by AI software? | No |

---

Description of contribution in a few bullet points

Fix out of bounds read from collision checking when x and y values are not valid and the worldToMap function returns false. New functionality: expansion will say it's in collision when the world ToMap function returns false

Description of documentation updates required from your changes

Description of how this change was tested

10 hours on robot

---

Future work that may be required in bullet points

For Maintainers: <!-- DO NOT EDIT OR REMOVE -->


  • Check that any new parameters added are updated in docs.nav2.org

  • Check that any significant change is added to the migration guide

  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide

  • Check that any new functions have Doxygen added

  • Check that any new features have test coverage

  • Check that any new plugins is added to the plugins page

  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists

  • Should this be backported to current distributions? If so, tag with backport-*.
  • Diff: 5 lines (+3 / -2) across 1 files Reviewer: SteveMacenski Review duration: 54413m
    All Vouch review confidence checks passed
    Residual risk 0.02 = Change Risk (0.14) × (1 − Review Confidence (0.91)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.14 · 5 lines diff across 1 files
    0.14
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.90 · 3 substantive comment(s)
    0.90
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    91%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.107
    Real PR Conversation Timeline
    7 items
    mini-1235 mini-1235 commented on code on Oct 11, 2026 05:28 UTC
    Code Review
    nav2_smac_planner/src/smoother.cpp:1
    @@ -312,8 +312,9 @@ void Smoother::findBoundaryExpansion(
     
         // Check for collision
         unsigned int mx, my;
    -    costmap->worldToMap(x, y, mx, my);
    -    if (static_cast<float>(costmap->getCost(mx, my)) >= INSCRIBED_COST) {
    +    if (!costmap->worldToMap(x, y, mx, my)) {
    +      expansion.in_collision = true;
    +    } else if (static_cast<float>(costmap->getCost(mx, my)) >= INSCRIBED_COST) {
           expansion.in_collision = true;
         }

        if (!costmap->worldToMap(x, y, mx, my) ||
          static_cast<float>(costmap->getCost(mx, my)) >= INSCRIBED_COST)
        {
          expansion.in_collision = true;
        }
    

    mini-1235 mini-1235 commented on Oct 11, 2026 05:29 UTC
    Reviewer
    bkrodinger bkrodinger commented on Oct 12, 2026 12:14 UTC
    Author

    Could you also check if the CI test failure is related to this PR? https://app.circleci.com/pipelines/github/ros-navigation/navigation2/20481/workflows/e80722eb-029a-447e-967e-6f7b43a76d05/jobs/65556

    Looks like it's using navfn planner when it fails. I did a brief trace through the test code and it looks like it's failing based on an interpolation mismatch. navfn allows returns from calcPath that are fractional (e.g 8.9, 88.1). The test_planner_random_node rounds to nearest discrete cell so it seems like a mismatch of what the test expects vs what navfn planner is capable of. That's my interpretation at least. I don't think it's related to this PR.

    codecov[bot] codecov[bot] commented on Oct 12, 2026 15:06 UTC
    Bot

    Codecov Report


    :white_check_mark: All modified and coverable lines are covered by tests.

    | Files with missing lines | Coverage Δ | |
    |---|---|---|
    | nav2\_smac\_planner/src/smoother.cpp | 96.98% <100.00%> (ø) | |

    ... and 10 files with indirect coverage changes
    <details><summary> :rocket: New features to boost your workflow: </summary>

  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

  • </details>

    SteveMacenski SteveMacenski approved these changes on Oct 12, 2026 20:28 UTC
    Approved Reviewer

    Please sign off with DCO and I can merge :-)

    SteveMacenski SteveMacenski approved these changes on Nov 17, 2026 19:32 UTC
    Approved Reviewer

    Sorry, I'm not sure why your update didnt' hit my notifications tray to re-review. Approved!

    Reviewers
    Assignees
    bkrodinger bkrodinger
    Labels
    risk: low confidence: 91.1% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 13.7% (LOW) · Higher = larger blast radius
    13.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 91.1% · Lower = rushed or shallow review
    91.1%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 2% · Safe to merge
    2%