Check queue set pointer size before loading data (#1527) Verifies the supplied queue set reference has the correct item size to receive an item from the underlying queue. We thank Claude and Ada Logics for their help identifying this issue.
diff --git a/History.txt b/History.txt index 3b376e4..6540133 100644 --- a/History.txt +++ b/History.txt
@@ -1,5 +1,11 @@ Documentation and download available at https://www.FreeRTOS.org/ +Changes between FreeRTOS V11.3.2 and FreeRTOS V11.3.3 released October 29, 2026 + + Fix a type confusion in xQueueSelectFromSet by verifying that the object + passed as the queue set really is a queue set, that is, that its item + size is sizeof( Queue_t * ). We thank Claude and Ada Logics for their + help identifying this issue. + Changes between FreeRTOS V11.3.1 and FreeRTOS V11.3.2 released October 16, 2026 + Add the ability for a port to selectively override the
diff --git a/queue.c b/queue.c index 41ef8ef..48f305a 100644 --- a/queue.c +++ b/queue.c
@@ -3311,7 +3311,13 @@ traceENTER_xQueueSelectFromSet( xQueueSet, xTicksToWait ); - ( void ) xQueueReceive( ( QueueHandle_t ) xQueueSet, &xReturn, xTicksToWait ); + /* Check the pointer is not NULL. */ + configASSERT( ( xQueueSet ) ); + + if( ( ( Queue_t * ) xQueueSet )->uxItemSize == ( UBaseType_t ) sizeof( Queue_t * ) ) + { + ( void ) xQueueReceive( ( QueueHandle_t ) xQueueSet, &xReturn, xTicksToWait ); + } traceRETURN_xQueueSelectFromSet( xReturn ); @@ -3329,7 +3335,13 @@ traceENTER_xQueueSelectFromSetFromISR( xQueueSet ); - ( void ) xQueueReceiveFromISR( ( QueueHandle_t ) xQueueSet, &xReturn, NULL ); + /* Check the pointer is not NULL. */ + configASSERT( ( xQueueSet ) ); + + if( ( ( Queue_t * ) xQueueSet )->uxItemSize == ( UBaseType_t ) sizeof( Queue_t * ) ) + { + ( void ) xQueueReceiveFromISR( ( QueueHandle_t ) xQueueSet, &xReturn, NULL ); + } traceRETURN_xQueueSelectFromSetFromISR( xReturn );