bug: ISR uses sizeof(tx_buf) instead of PACKET_LEN for half-bit count #31

Closed
opened 2026-08-02 05:25:20 +00:00 by time · 1 comment
Contributor

tx_isr checks tx_bit_idx < sizeof(tx_buf) * 16, but sizeof(tx_buf) returns byte size (30), giving 480 iterations instead of the intended 240 (PACKET_LEN × 16). This reads out-of-bounds past tx_buf into tx_bit_idx and tx_done memory, corrupting output. Fix: use PACKET_LEN * 16.

tx_isr checks tx_bit_idx < sizeof(tx_buf) * 16, but sizeof(tx_buf) returns byte size (30), giving 480 iterations instead of the intended 240 (PACKET_LEN × 16). This reads out-of-bounds past tx_buf into tx_bit_idx and tx_done memory, corrupting output. Fix: use PACKET_LEN * 16.
Author
Contributor

Fixed in PR #39: ISR was completely rewritten — no longer uses sizeof(tx_buf). Main loop iterates PACKET_LEN * 2 over the 8-bit buffer.

Fixed in PR #39: ISR was completely rewritten — no longer uses sizeof(tx_buf). Main loop iterates PACKET_LEN * 2 over the 8-bit buffer.
time closed this issue 2026-08-03 04:06:57 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
daru/PICsense#31
No description provided.