Skip to content

Commit 351dee5

Browse files
committed
backport ZSTR_MAX_LEN
(cherry picked from commit 37056ad) (cherry picked from commit ff86894)
1 parent fe1067a commit 351dee5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Zend/zend_string.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ END_EXTERN_C()
6262

6363
#define _ZSTR_STRUCT_SIZE(len) (_ZSTR_HEADER_SIZE + len + 1)
6464

65+
#define ZSTR_MAX_OVERHEAD (ZEND_MM_ALIGNED_SIZE(_ZSTR_HEADER_SIZE + 1))
66+
#define ZSTR_MAX_LEN (SIZE_MAX - ZSTR_MAX_OVERHEAD)
67+
6568
#define ZSTR_ALLOCA_ALLOC(str, _len, use_heap) do { \
6669
(str) = (zend_string *)do_alloca(ZEND_MM_ALIGNED_SIZE_EX(_ZSTR_STRUCT_SIZE(_len), 8), (use_heap)); \
6770
GC_REFCOUNT(str) = 1; \

0 commit comments

Comments
 (0)