Skip to content

Fix heap buffer overflow in QubeServoPendulum analog read#12

Merged
baggepinnen merged 2 commits intomainfrom
as/fix
Mar 10, 2026
Merged

Fix heap buffer overflow in QubeServoPendulum analog read#12
baggepinnen merged 2 commits intomainfrom
as/fix

Conversation

@asinghvi17
Copy link
Contributor

Summary

  • Fixed a heap buffer overflow in QubeServoPendulum: analog_channel_read was UInt32[0] (requesting 1 channel read) while analog_read_buffer was zeros(Int32, 0) (0 elements). Every call to measure() caused hil_read_analog to write 8 bytes (Float64) past the end of the zero-length buffer, corrupting heap memory. This manifested as the arm encoder reporting phantom rotation while the arm was physically stationary.
  • Added workspace entry to root Project.toml

Test plan

  • Verified fix resolves phantom arm rotation on physical Qube Servo hardware
  • Run existing tests with ] test

🤖 Generated with Claude Code

asinghvi17 and others added 2 commits March 10, 2026 11:17
analog_channel_read was set to UInt32[0] (requesting 1 channel) while
analog_read_buffer was zeros(Int32, 0) (0 elements), causing
hil_read_analog to write past the buffer. This corrupted heap memory
and caused the arm encoder to report phantom rotation. The analog
channel is unused by QubeServoPendulum, so remove the read entirely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@baggepinnen baggepinnen merged commit eb31f4c into main Mar 10, 2026
1 check passed
@baggepinnen baggepinnen deleted the as/fix branch March 10, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants