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

This commit adds an assert check to xRingbufferReceive() and
xRingbufferReceiveFromISR() functions to prevent them from being used to
retrieve items from an allow-split buffer. Corresponding documentation
has also been updated.
This commit is contained in:
Sudeep Mohanty
2025-03-19 12:09:08 +01:00
parent 72a684c1f0
commit db9d88c0d4
4 changed files with 15 additions and 3 deletions

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;