Skip to content

Commit 2bc0a6e

Browse files
committed
Fix string offset signed int UB in jit as well
1 parent ed37254 commit 2bc0a6e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_str_r_helper(zval *container, zval
610610
offset = Z_LVAL_P(dim);
611611
}
612612

613-
if (UNEXPECTED(Z_STRLEN_P(container) < (size_t)((offset < 0) ? -offset : (offset + 1)))) {
613+
if (UNEXPECTED(Z_STRLEN_P(container) < ((offset < 0) ? -(size_t)offset : ((size_t)offset + 1)))) {
614614
zend_error(E_WARNING, "Uninitialized string offset: " ZEND_LONG_FMT, offset);
615615
ZVAL_EMPTY_STRING(result);
616616
} else {
@@ -658,7 +658,7 @@ static void ZEND_FASTCALL zend_jit_fetch_dim_str_is_helper(zval *container, zval
658658
offset = Z_LVAL_P(dim);
659659
}
660660

661-
if (UNEXPECTED(Z_STRLEN_P(container) < (size_t)((offset < 0) ? -offset : (offset + 1)))) {
661+
if (UNEXPECTED(Z_STRLEN_P(container) < ((offset < 0) ? -(size_t)offset : ((size_t)offset + 1)))) {
662662
ZVAL_NULL(result);
663663
} else {
664664
zend_uchar c;

0 commit comments

Comments
 (0)