Skip to content

Commit

Permalink
add assert for addition overflow on queue creation (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
cobusve committed Dec 7, 2020
1 parent d05b9c1 commit 4733839
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,9 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
/* Check for multiplication overflow. */
configASSERT( ( uxItemSize == 0 ) || ( uxQueueLength == ( xQueueSizeInBytes / uxItemSize ) ) );

/* Check for addition overflow. */
configASSERT( ( sizeof( Queue_t ) + xQueueSizeInBytes ) > xQueueSizeInBytes );

/* Allocate the queue and storage area. Justification for MISRA
* deviation as follows: pvPortMalloc() always ensures returned memory
* blocks are aligned per the requirements of the MCU stack. In this case
Expand Down

0 comments on commit 4733839

Please sign in to comment.