diff options
author | Cobus van Eeden <35851496+cobusve@users.noreply.github.com> | 2020-12-07 22:48:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 22:48:51 +0300 |
commit | 47338393f1f79558f6144213409f09f81d7c4837 (patch) | |
tree | 43c1dce32766128e8e27fa44f3bf1b5b9f1a40c6 /queue.c | |
parent | d05b9c123f2bf9090bce386a244fc934ae44db5b (diff) |
add assert for addition overflow on queue creation (#225)
Diffstat (limited to 'queue.c')
-rw-r--r-- | queue.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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
|