From f770569cad38053457f77cf08fd46b5549851635 Mon Sep 17 00:00:00 2001 From: bradAPD <55818640+bradAPD@users.noreply.github.com> Date: Wed, 19 Jul 2023 16:55:16 +1000 Subject: [PATCH] canardHandleRxFrame(): Avoid multi-frame transfer assert() failure for 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. --- canard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/canard.c b/canard.c index 796ca66..067a6f2 100644 --- a/canard.c +++ b/canard.c @@ -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);