-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SET_ALT fixes and tightening #11491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: maintenance-10.x
Are you sure you want to change the base?
SET_ALT fixes and tightening #11491
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4218,14 +4218,15 @@ bool mspFCProcessInOutCommand(uint16_t cmdMSP, sbuf_t *dst, sbuf_t *src, mspResu | |
| break; | ||
| #endif | ||
|
|
||
| #ifdef USE_BARO | ||
| #ifdef USE_GPS | ||
| case MSP2_INAV_SET_ALT_TARGET: | ||
| if (dataSize != (sizeof(int32_t) + sizeof(uint8_t))) { | ||
| *ret = MSP_RESULT_ERROR; | ||
| break; | ||
| } | ||
|
|
||
| if (navigationSetAltitudeTargetWithDatum((geoAltitudeDatumFlag_e)sbufReadU8(src), (int32_t)sbufReadU32(src))) { | ||
| uint8_t setAltDatum = (geoAltitudeDatumFlag_e)sbufReadU8(src); | ||
| int32_t setNewAlt = sbufReadU32(src); | ||
| if (navigationSetAltitudeTargetWithDatum(setAltDatum, setNewAlt)) { | ||
|
Comment on lines
+4227
to
+4229
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. setnewalt lacks validation The MSP handler assigns sbufReadU32(src) into int32_t setNewAlt without validating it fits in int32_t, so a crafted payload can trigger implementation-defined signed conversion rather than a deterministic error. External input fields (setAltDatum, altitude) should be range/enum-validated before use and rejected with a specific error result. Agent Prompt
|
||
| *ret = MSP_RESULT_ACK; | ||
| break; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1215,7 +1215,7 @@ static bool handleIncoming_COMMAND_INT(void) | |
| mavlinkSendMessage(); | ||
| } | ||
| } else { | ||
| #ifdef USE_BARO | ||
| #ifdef USE_GPS | ||
| if (msg.command == MAV_CMD_DO_CHANGE_ALTITUDE) { | ||
| const float altitudeMeters = msg.param1; | ||
| const uint8_t frame = (uint8_t)msg.frame; | ||
|
Comment on lines
+1218
to
1221
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3. Mavlink set_alt gps-gated MAV_CMD_DO_CHANGE_ALTITUDE handling is now compiled only when USE_GPS is defined, causing barometer-only builds to always respond UNSUPPORTED to altitude-change commands. This breaks the MAV_FRAME_GLOBAL_RELATIVE_ALT path which maps to takeoff datum and does not require GPS origin. Agent Prompt
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. Msp set_alt gps-gated
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools