Trackback flight controller lock up fix#11393
Trackback flight controller lock up fix#11393breadoven wants to merge 1 commit intoiNavFlight:maintenance-9.xfrom
Conversation
Branch Targeting SuggestionYou've targeted the
If This is an automated suggestion to help route contributions to the appropriate branch. |
Review Summary by QodoFix trackback flight controller lockup with array bounds validation
WalkthroughsDescription• Prevents flight controller lockup by validating trackback array index before setting position • Fixes issue where invalid array index caused undefined behavior during trackback initialization • Improves trackback termination logic to correctly detect last waypoint • Affects all INAV versions since trackback feature introduction in v6.0 Diagramflowchart LR
A["Waypoint Reached"] --> B["Decrement activePointIndex"]
B --> C["Check if activePointIndex equals WrapAroundCounter"]
C -->|Not Equal| D["Set Position with Valid Index"]
C -->|Equal| E["End Trackback Safely"]
D --> F["Continue Navigation"]
E --> F
File Changes1. src/main/navigation/rth_trackback.c
|
Code Review by Qodo
1. Trackback ends one loop late
|
|
Test firmware build ready — commit Download firmware for PR #11393 223 targets built. Find your board's
|
Should provide a fix for #11392 and #11007.
Prevents a position being set when the trackback array index is < 0 which can cause the flight controller to lock up in some instances.
It's an issue if trackback is initiated when the trackback store hasn't completely filled initially and then runs back to the first trackback point set. Once the trackback point store has filled and is wrapping around the problem goes away.
This issue affects all versions of INAV back to 6.0 when trackback was first introduced. It's not clear why it only seems to cause occasional FC lockups, likely just a result of undefined behaviour when trying to set a position with an invalid array index.
HITL testing shows the position is no longer set if the trackback array index is < 0.