Skip to content

Conversation

@arche8
Copy link

@arche8 arche8 commented Nov 10, 2025

Bug Description
When I2C SYSEX messages containing the 'v' command byte but without parameters will cause system crashes due to uninitialized NULL pointer dereference in the I2C interrupt handler. When argc = 0, the code performs out-of-bounds access to determine operation mode, enters I2C write branch(https://github.com/firmata/arduino/blob/main/examples/StandardFirmata/StandardFirmata.ino#L510) without buffer allocation, and crashes when the interrupt handler attempts to write through uninitialized txBuffer.

Proposed Fix
Add comprehensive parameter validation in sysexCallback function:

  • Validate argc >= 2 before I2C request processing
  • Validate argc > 2 for I2C write operations
  • Early return with error messages for invalid parameters
  • Ensure wireWrite is called to allocate buffers before transmission

@arche8 arche8 marked this pull request as ready for review November 10, 2025 11:54
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.

1 participant