Skip to content

Validate timer command ID lower bound in xTimerGenericCommandFromTask - #1477

Merged
kstribrnAmzn merged 2 commits into
FreeRTOS:mainfrom
rawalexe:fix/timer-command-id-lower-bound
Aug 21, 2026
Merged

kstribrnAmzn merged 2 commits into
FreeRTOS:mainfrom
rawalexe:fix/timer-command-id-lower-bound

Conversation

@rawalexe

@rawalexe rawalexe commented Aug 20, 2026

Copy link
Copy Markdown
Member

Description

The task command path in xTimerGenericCommandFromTask() validated xCommandID only against the upper bound tmrFIRST_FROM_ISR_COMMAND; there was no corresponding lower bound. This change adds the lower bound so the accepted range is fully constrained to the valid task command set.

tmrCOMMAND_START_DONT_TRACE (0) is the lowest legitimate task-issued command and tmrCOMMAND_DELETE (5) is the highest; the existing upper bound already excluded the ISR commands. Behaviour for valid commands is unchanged — a rejected command returns pdFAIL, matching the pre-existing rejection path.

Scope is the task path only. xTimerGenericCommandFromISR() is untouched.

Test Steps

Tested by creating a demo and checking the output

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

The unit-test (CMock) suite for the kernel lives in the separate
FreeRTOS/FreeRTOS repository, not in this repository, so no test was added
here.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

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.
@kstribrnAmzn
kstribrnAmzn merged commit a0e2097 into FreeRTOS:main Aug 21, 2026
14 of 15 checks passed
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants