Skip to content

Commit

Permalink
canardHandleRxFrame(): Avoid multi-frame transfer assert() failure fo…
Browse files Browse the repository at this point in the history
…r a valid operation.

Modifying underflow assert check. This check mistakenly invalidates the case where the final CAN frame of a transfer is received with all previously allocated memory blocks fully utilised.
  • Loading branch information
bradAPD authored and tridge committed Aug 31, 2023
1 parent bc8be8f commit f770569
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion canard.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ int16_t canardHandleRxFrame(CanardInstance* ins, const CanardCANFrame* frame, ui
CANARD_ASSERT(block != NULL);

const size_t offset_within_block = rx_state->payload_len - offset;
CANARD_ASSERT(offset_within_block < CANARD_BUFFER_BLOCK_DATA_SIZE);
CANARD_ASSERT(offset_within_block <= CANARD_BUFFER_BLOCK_DATA_SIZE);

for (size_t i = offset_within_block;
(i < CANARD_BUFFER_BLOCK_DATA_SIZE) && (tail_offset < frame_payload_size);
Expand Down

0 comments on commit f770569

Please sign in to comment.