Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FreeRTOS/FreeRTOS-Kernel.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCobus van Eeden <35851496+cobusve@users.noreply.github.com>2020-12-07 22:48:51 +0300
committerGitHub <noreply@github.com>2020-12-07 22:48:51 +0300
commit47338393f1f79558f6144213409f09f81d7c4837 (patch)
tree43c1dce32766128e8e27fa44f3bf1b5b9f1a40c6 /queue.c
parentd05b9c123f2bf9090bce386a244fc934ae44db5b (diff)
add assert for addition overflow on queue creation (#225)
Diffstat (limited to 'queue.c')
-rw-r--r--queue.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/queue.c b/queue.c
index d2e27e55a..b01dfd11f 100644
--- a/queue.c
+++ b/queue.c
@@ -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