Skip to content

Commit 7299af0

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fixed hex char parsing
2 parents 70a3b33 + 5830938 commit 7299af0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/ffi/ffi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7320,23 +7320,25 @@ void zend_ffi_val_character(zend_ffi_val *val, const char *str, size_t str_len)
73207320
val->kind = ZEND_FFI_VAL_ERROR;
73217321
}
73227322
} else if (str[2] == 'x') {
7323-
if (str[3] >= '0' && str[3] <= '7') {
7323+
if (str[3] >= '0' && str[3] <= '9') {
73247324
n = str[3] - '0';
73257325
} else if (str[3] >= 'A' && str[3] <= 'F') {
73267326
n = str[3] - 'A';
73277327
} else if (str[3] >= 'a' && str[3] <= 'f') {
73287328
n = str[3] - 'a';
73297329
} else {
73307330
val->kind = ZEND_FFI_VAL_ERROR;
7331+
return;
73317332
}
7332-
if ((str[4] >= '0' && str[4] <= '7') && str_len == 6) {
7333+
if ((str[4] >= '0' && str[4] <= '9') && str_len == 6) {
73337334
n = n * 16 + (str[4] - '0');
73347335
} else if ((str[4] >= 'A' && str[4] <= 'F') && str_len == 6) {
73357336
n = n * 16 + (str[4] - 'A');
73367337
} else if ((str[4] >= 'a' && str[4] <= 'f') && str_len == 6) {
73377338
n = n * 16 + (str[4] - 'a');
73387339
} else if (str_len != 5) {
73397340
val->kind = ZEND_FFI_VAL_ERROR;
7341+
return;
73407342
}
73417343
val->ch = n;
73427344
} else if (str_len == 4) {

0 commit comments

Comments
 (0)