Merge branch 'fix/ringbuf_allow_split_receive_crash_v5.3' into 'release/v5.3'

fix(ringbuf): xRingbufferReceive() crashes for allow-split buffers (v5.3)

See merge request espressif/esp-idf!37923
This commit is contained in:
Marius Vikhammer
2025-04-16 15:31:12 +08:00
4 changed files with 15 additions and 3 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -225,7 +225,8 @@ BaseType_t xRingbufferSendComplete(RingbufHandle_t xRingbuffer, void *pvItem);
* @param[in] xTicksToWait Ticks to wait for items in the ring buffer.
*
* @note A call to vRingbufferReturnItem() is required after this to free the item retrieved.
* @note It is possible to receive items with a pxItemSize of 0 on no-split/allow split buffers.
* @note It is possible to receive items with a pxItemSize of 0 on no-split buffers.
* @note To retrieve an item from an allow-split buffer, use `xRingbufferReceiveSplit()` instead.
*
* @return
* - Pointer to the retrieved item on success; *pxItemSize filled with the length of the item.
@@ -246,7 +247,8 @@ void *xRingbufferReceive(RingbufHandle_t xRingbuffer, size_t *pxItemSize, TickTy
* @note A call to vRingbufferReturnItemFromISR() is required after this to free the item retrieved.
* @note Byte buffers do not allow multiple retrievals before returning an item
* @note Two calls to RingbufferReceiveFromISR() are required if the bytes wrap around the end of the ring buffer.
* @note It is possible to receive items with a pxItemSize of 0 on no-split/allow split buffers.
* @note It is possible to receive items with a pxItemSize of 0 on no-split buffers.
* @note To retrieve an item from an allow-split buffer, use `xRingbufferReceiveSplitFromISR()` instead.
*
* @return
* - Pointer to the retrieved item on success; *pxItemSize filled with the length of the item.
+2
View File
@@ -1124,6 +1124,7 @@ void *xRingbufferReceive(RingbufHandle_t xRingbuffer, size_t *pxItemSize, TickTy
//Check arguments
configASSERT(pxRingbuffer && pxItemSize);
configASSERT((pxRingbuffer->uxRingbufferFlags & rbALLOW_SPLIT_FLAG) == 0); // This function must not be called for allow-split buffers
//Attempt to retrieve an item
void *pvTempItem;
@@ -1140,6 +1141,7 @@ void *xRingbufferReceiveFromISR(RingbufHandle_t xRingbuffer, size_t *pxItemSize)
//Check arguments
configASSERT(pxRingbuffer && pxItemSize);
configASSERT((pxRingbuffer->uxRingbufferFlags & rbALLOW_SPLIT_FLAG) == 0); // This function must not be called for allow-split buffers
//Attempt to retrieve an item
void *pvTempItem;