Skip to content

Commit ff86894

Browse files
committed
backport ZSTR_MAX_LEN
(cherry picked from commit 37056ad)
1 parent 8a4f389 commit ff86894

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
@@ -74,6 +74,9 @@ END_EXTERN_C()
7474

7575
#define _ZSTR_STRUCT_SIZE(len) (_ZSTR_HEADER_SIZE + len + 1)
7676

77+
#define ZSTR_MAX_OVERHEAD (ZEND_MM_ALIGNED_SIZE(_ZSTR_HEADER_SIZE + 1))
78+
#define ZSTR_MAX_LEN (SIZE_MAX - ZSTR_MAX_OVERHEAD)
79+
7780
#define ZSTR_ALLOCA_ALLOC(str, _len, use_heap) do { \
7881
(str) = (zend_string *)do_alloca(ZEND_MM_ALIGNED_SIZE_EX(_ZSTR_STRUCT_SIZE(_len), 8), (use_heap)); \
7982
GC_REFCOUNT(str) = 1; \

0 commit comments

Comments
 (0)