20.01.2014, 19:00
There's a bug in amx_Allot() where it checks whether there's enough space on the heap:
The expression on the left is always positive because of the convertion to size_t (which is unsigned). It can be fixed by replacing the first line with:
This also affects amx_PushString() and amx_PushArray() as they use this function internally.
Код:
if (amx->stk - amx->hea - cells*sizeof(cell) < STKMARGIN) return AMX_ERR_MEMORY;
Код:
if ((size_t)amx->stk < (size_t)(amx->hea + cells*sizeof(cell) + STKMARGIN))