mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-10-09 23:53:04 -04:00
Merge d698ab2a01 into 8be86d4a24
This commit is contained in:
commit
953e78c983
1 changed files with 13 additions and 0 deletions
13
tasks.c
13
tasks.c
|
|
@ -1637,6 +1637,19 @@ STATIC void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
|
|||
{
|
||||
TCB_t * pxNewTCB;
|
||||
|
||||
/* uxStackDepth is a word count that gets multiplied by
|
||||
* sizeof( StackType_t ) below to get a byte count for the stack
|
||||
* allocation. On targets where configSTACK_DEPTH_TYPE / size_t is
|
||||
* 32-bit, an oversized uxStackDepth can make that multiplication
|
||||
* wrap, silently allocating a far smaller stack than requested
|
||||
* while prvInitialiseNewTask() still initialises the task using
|
||||
* the original, larger uxStackDepth. Reject that up front and
|
||||
* treat it the same as any other allocation failure. */
|
||||
if( ( SIZE_MAX / sizeof( StackType_t ) ) < ( size_t ) uxStackDepth )
|
||||
{
|
||||
pxNewTCB = NULL;
|
||||
}
|
||||
else
|
||||
/* If the stack grows down then allocate the stack then the TCB so the stack
|
||||
* does not grow into the TCB. Likewise if the stack grows up then allocate
|
||||
* the TCB then the stack. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue