Skip to content

Commit 49481f3

Browse files
committed
FIX: allow pool size to be larger than series total length in evoke memory check
related to: zsx#49
1 parent 6901c17 commit 49481f3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/core/m-pools.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,10 @@ const REBPOOLSPEC Mem_Pool_Spec[MAX_POOLS] =
696696
goto crash;
697697
// Does the size match a known pool?
698698
pool_num = FIND_POOL(SERIES_TOTAL(series));
699-
// Just to be sure the pool matches the allocation:
700-
if (pool_num < SERIES_POOL && Mem_Pools[pool_num].wide != SERIES_TOTAL(series))
699+
// Just to be sure the pool size is enough to hold total series length
700+
// Originaly it was expecting exact size match, but there may be cases
701+
// where series' total size may be lower than pool wide.
702+
if (pool_num < SERIES_POOL && Mem_Pools[pool_num].wide < SERIES_TOTAL(series))
701703
goto crash;
702704
}
703705
series++;
@@ -715,7 +717,8 @@ const REBPOOLSPEC Mem_Pool_Spec[MAX_POOLS] =
715717
for (seg = Mem_Pools[pool_num].segs; seg; seg = seg->next) {
716718
if ((REBUPT)node > (REBUPT)seg && (REBUPT)node < (REBUPT)seg + (REBUPT)seg->size) break;
717719
}
718-
if (!seg) goto crash;
720+
if (!seg)
721+
goto crash;
719722
//pnode = node; // for debugger
720723
}
721724
// The number of free nodes must agree with header:

0 commit comments

Comments
 (0)