Skip to content

Commit bf14fdc

Browse files
committed
Merge pull request $450 from pepepr08:fix-449-update-malloc-stub
Fix #449, update PCS_malloc stub PoolSize overflow
2 parents cdc73e5 + 4e7e3f1 commit bf14fdc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

unit-test-coverage/ut-stubs/src/PCS_stdlib_handlers.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ void UT_DefaultHandler_PCS_malloc(void *UserObj, UT_EntryKey_t FuncKey, const UT
8989
PoolStart = (PoolStart + MPOOL_ALIGN - 1) & ~((cpuaddr)MPOOL_ALIGN - 1);
9090
PoolSize = PoolEnd - PoolStart;
9191

92-
if (PoolSize > (MPOOL_ALIGN * 2))
92+
/*
93+
* Verify PollSize is greater than minimun size and
94+
* that PoolStart didn't go past the PoolEnd during alignment.
95+
*/
96+
if (PoolSize > (MPOOL_ALIGN * 2) && PoolStart < PoolEnd)
9397
{
9498
Rec = (struct MPOOL_REC *)PoolStart;
9599
NextBlock = PoolStart + MPOOL_ALIGN;

0 commit comments

Comments
 (0)