fix: Verify queue set type during usage (#1476)

Verify that a queue set is passed when attempting
to add a queue to the queue set.
This commit is contained in:
Kody Stribrny 2026-08-21 09:22:13 -07:00 • committed by GitHub
parent ce221a8bb4
commit 5f109e6f55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

11
queue.c
View file

@ -3225,7 +3225,16 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
taskENTER_CRITICAL();
{
if( ( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer != NULL )
if( ( ( Queue_t * ) xQueueSet )->uxItemSize != ( UBaseType_t ) sizeof( Queue_t * ) )
{
/* The object passed as the queue set is not a queue set. A queue
* set always has an item size of sizeof( Queue_t * ). Reject any
* other object to prevent a type confusion in which
* prvNotifyQueueSetContainer() would later copy uxItemSize bytes
* from a single pointer on the stack. */
xReturn = pdFAIL;
}
else if( ( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer != NULL )
{
/* Cannot add a queue/semaphore to more than one queue set. */
xReturn = pdFAIL;