Skip to content

Commit 56a8a67

Browse files
committed
ATRONIX: Avoid undefined behavior caused by malloc(0)
Found by clang-analyzer (cherry picked from commit 7d090b2)
1 parent b9eadc1 commit 56a8a67

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/core/m-pools.c

+2
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ const REBPOOLSPEC Mem_Pool_Spec[MAX_POOLS] =
376376

377377
series = (REBSER *)Make_Node(SERIES_POOL);
378378
length *= wide;
379+
ASSERT(length != 0, RP_BAD_SERIES);
380+
379381
pool_num = FIND_POOL(length);
380382
if (pool_num < SYSTEM_POOL) {
381383
pool = &Mem_Pools[pool_num];

0 commit comments

Comments
 (0)