Skip to content

Commit 4733839

Browse files
authored
add assert for addition overflow on queue creation (#225)
1 parent d05b9c1 commit 4733839

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

queue.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
397397
/* Check for multiplication overflow. */
398398
configASSERT( ( uxItemSize == 0 ) || ( uxQueueLength == ( xQueueSizeInBytes / uxItemSize ) ) );
399399

400+
/* Check for addition overflow. */
401+
configASSERT( ( sizeof( Queue_t ) + xQueueSizeInBytes ) > xQueueSizeInBytes );
402+
400403
/* Allocate the queue and storage area. Justification for MISRA
401404
* deviation as follows: pvPortMalloc() always ensures returned memory
402405
* blocks are aligned per the requirements of the MCU stack. In this case

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy