Add assert to catch invalid task priority (#292)

* Add assert to catch invalid task priority

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
diff --git a/tasks.c b/tasks.c
index 988e32b..a1a6aac 100644
--- a/tasks.c
+++ b/tasks.c
@@ -913,8 +913,8 @@
         pxNewTCB->pcTaskName[ 0 ] = 0x00;

     }

 

-    /* This is used as an array index so must ensure it's not too large.  First

-     * remove the privilege bit if one is present. */

+    /* This is used as an array index so must ensure it's not too large. */

+    configASSERT( uxPriority < configMAX_PRIORITIES );

     if( uxPriority >= ( UBaseType_t ) configMAX_PRIORITIES )

     {

         uxPriority = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) 1U;

@@ -1544,7 +1544,7 @@
         UBaseType_t uxCurrentBasePriority, uxPriorityUsedOnEntry;

         BaseType_t xYieldRequired = pdFALSE;

 

-        configASSERT( ( uxNewPriority < configMAX_PRIORITIES ) );

+        configASSERT( uxNewPriority < configMAX_PRIORITIES );

 

         /* Ensure the new priority is valid. */

         if( uxNewPriority >= ( UBaseType_t ) configMAX_PRIORITIES )