Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/json/json_scanner.re
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ std:
<STR_P1>ANY {
if (s->options & (PHP_JSON_INVALID_UTF8_IGNORE | PHP_JSON_INVALID_UTF8_SUBSTITUTE)) {
if (s->options & PHP_JSON_INVALID_UTF8_SUBSTITUTE) {
if (s->utf8_invalid_count > INT_MAX - 2) {
if (s->utf8_invalid_count > PTRDIFF_MAX - 2) {
s->errcode = PHP_JSON_ERROR_UTF8;
return PHP_JSON_T_ERROR;
}
Expand Down
4 changes: 2 additions & 2 deletions ext/json/php_json_scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ typedef struct _php_json_scanner {
php_json_ctype *line_start; /* start position of the current line */
uint64_t line; /* current line number (1-based) */
zval value; /* value */
int str_esc; /* number of extra characters for escaping */
ptrdiff_t str_esc; /* number of extra characters for escaping */
int state; /* condition state */
int options; /* options */
php_json_error_code errcode; /* error type if there is an error */
int utf8_invalid; /* whether utf8 is invalid */
int utf8_invalid_count; /* number of extra character for invalid utf8 */
ptrdiff_t utf8_invalid_count; /* number of extra character for invalid utf8 */
} php_json_scanner;

void php_json_scanner_init(php_json_scanner *scanner, const char *str, size_t str_len, int options);
Expand Down
Loading