mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 00:28:30 -04:00
AP_HAL_Linux: [Bugfix] prevent memory acces violation in process_dsm_pulse
When a S.Bus signal is fed into the rcin-Pin AruPlane on the BBB get's a Segmentation fault. This patch prevents the memory acces to dsm_state.bytes[16] outside of the array bounds. The patch should be reviewed by sombody who knows the DSM protocol, as i don't.
This commit is contained in:
parent
05b903654e
commit
14c401c0f4
@ -249,6 +249,11 @@ void LinuxRCInput::_process_dsm_pulse(uint16_t width_s0, uint16_t width_s1)
|
|||||||
|
|
||||||
byte_ofs = dsm_state.bit_ofs/10;
|
byte_ofs = dsm_state.bit_ofs/10;
|
||||||
bit_ofs = dsm_state.bit_ofs%10;
|
bit_ofs = dsm_state.bit_ofs%10;
|
||||||
|
|
||||||
|
if(byte_ofs > 15) {
|
||||||
|
// invalid data
|
||||||
|
goto reset;
|
||||||
|
}
|
||||||
|
|
||||||
// pull in the high bits
|
// pull in the high bits
|
||||||
nbits = bits_s0;
|
nbits = bits_s0;
|
||||||
|
Loading…
Reference in New Issue
Block a user