Check for string overflow

This commit is contained in:
Stanislav Malyshev 2016-08-10 23:46:33 -07:00
parent 4f6a97f532
commit 7bf6d98535

View File

@ -61,6 +61,9 @@
: newlen + SMART_STRING_PREALLOC; \
SMART_STRING_DO_REALLOC(d, what); \
} else { \
if(UNEXPECTED(n > SIZE_MAX - (d)->len)) { \
zend_error(E_ERROR, "String size overflow"); \
} \
newlen = (d)->len + (n); \
if (newlen >= (d)->a) { \
(d)->a = newlen + SMART_STRING_PREALLOC; \