Skip to content

Commit c097912

Browse files
OrvidHhvm Bot
authored andcommitted
Don't allow smart_str to overflow int
Summary: Don't allow smart_str to overflow int in the zend portability layer. Reviewed By: paulbiss Differential Revision: D3664307 fbshipit-source-id: eeed6fdc6f55ff3ac0c1cfd1f3f690eb0a4b213a
1 parent 4760594 commit c097912

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

hphp/runtime/ext_zend_compat/php-src/ext/standard/php_smart_str.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868
newlen = (d)->len + (n); \
6969
if (newlen >= (d)->a) { \
7070
(d)->a = newlen + SMART_STR_PREALLOC; \
71+
if (UNEXPECTED((d)->a >= INT_MAX)) { \
72+
HPHP::raise_error("String size overflow"); \
73+
} \
7174
SMART_STR_DO_REALLOC(d, what); \
7275
} \
7376
} \

0 commit comments

Comments
 (0)