From 0c9b3fc8b76f07aa9a5669c70d7bdea14e0ff2bb Mon Sep 17 00:00:00 2001 From: David Chalco Date: Mon, 22 Jun 2020 12:52:10 -0700 Subject: [PATCH] Added protection for xQueueGenericCreate --- queue.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/queue.c b/queue.c index b30d21215..9d9830330 100644 --- a/queue.c +++ b/queue.c @@ -378,6 +378,9 @@ Queue_t * const pxQueue = xQueue; zero in the case the queue is used as a semaphore. */ xQueueSizeInBytes = ( size_t ) ( uxQueueLength * uxItemSize ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ + /* Check for multiplication overflow */ + configASSERT( uxItemSize == 0 || uxQueueLength == xQueueSizeInBytes / uxItemSize ); + /* 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