From bff7c03f26a9ce5101b979cb6ade120adcb12001 Mon Sep 17 00:00:00 2001 From: David Chalco Date: Mon, 22 Jun 2020 13:37:55 -0700 Subject: [PATCH] prevent eventual invalid state change from int8 overflow --- queue.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/queue.c b/queue.c index 9d9830330..29bd06d9c 100644 --- a/queue.c +++ b/queue.c @@ -1095,6 +1095,8 @@ Queue_t * const pxQueue = xQueue; { /* Increment the lock count so the task that unlocks the queue knows that data was posted while it was locked. */ + configASSERT( pxQueue->cTxLock != INT8_MAX ); + pxQueue->cTxLock = ( int8_t ) ( cTxLock + 1 ); } @@ -1260,6 +1262,8 @@ Queue_t * const pxQueue = xQueue; { /* Increment the lock count so the task that unlocks the queue knows that data was posted while it was locked. */ + configASSERT( pxQueue->cTxLock != INT8_MAX ); + pxQueue->cTxLock = ( int8_t ) ( cTxLock + 1 ); } @@ -1859,6 +1863,8 @@ Queue_t * const pxQueue = xQueue; { /* Increment the lock count so the task that unlocks the queue knows that data was removed while it was locked. */ + configASSERT( pxQueue->cRxLock != INT8_MAX ); + pxQueue->cRxLock = ( int8_t ) ( cRxLock + 1 ); } @@ -2922,6 +2928,8 @@ Queue_t * const pxQueue = xQueue; } else { + configASSERT( pxQueueSetContainer->cTxLock != INT8_MAX ); + pxQueueSetContainer->cTxLock = ( int8_t ) ( cTxLock + 1 ); } }