Validate timer command ID lower bound in xTimerGenericCommandFromTask (#1477)

The task command path validated the command ID only against the upper bound. Add the corresponding lower-bound check so the accepted range is fully constrained.
This commit is contained in:
Anubhav Rawal 2026-08-21 09:39:18 -07:00 • committed by GitHub
parent ce36e04208
commit a0e2097c6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -467,9 +467,11 @@
xMessage.u.xTimerParameters.xMessageValue = xOptionalValue; xMessage.u.xTimerParameters.xMessageValue = xOptionalValue;
xMessage.u.xTimerParameters.pxTimer = xTimer; xMessage.u.xTimerParameters.pxTimer = xTimer;
configASSERT( xCommandID < tmrFIRST_FROM_ISR_COMMAND ); /* Enforce a lower bound as well as an upper bound so that only
* valid task-issued commands are accepted here. */
configASSERT( ( xCommandID >= tmrCOMMAND_START_DONT_TRACE ) && ( xCommandID < tmrFIRST_FROM_ISR_COMMAND ) );
if( xCommandID < tmrFIRST_FROM_ISR_COMMAND ) if( ( xCommandID >= tmrCOMMAND_START_DONT_TRACE ) && ( xCommandID < tmrFIRST_FROM_ISR_COMMAND ) )
{ {
if( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING ) if( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING )
{ {