diff options
author | Jakub Zelenka <bukka@php.net> | 2015-01-04 17:34:18 +0000 |
---|---|---|
committer | Jakub Zelenka <bukka@php.net> | 2015-01-04 17:34:49 +0000 |
commit | 1119c4d2b210730e6c26f034e9769d116b26ceb1 (patch) | |
tree | e388cbe9709c43d1500d9705f3fab3c8f27b2f6f /ext/json/json_scanner.re | |
parent | 32d54acd00cfff8f501c0761ffa662cf9556b60e (diff) | |
download | php-git-1119c4d2b210730e6c26f034e9769d116b26ceb1.tar.gz |
Allow ill-formed unicode escapes in decoder
Diffstat (limited to 'ext/json/json_scanner.re')
-rw-r--r-- | ext/json/json_scanner.re | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/ext/json/json_scanner.re b/ext/json/json_scanner.re index 0592da83fd..b2add4b191 100644 --- a/ext/json/json_scanner.re +++ b/ext/json/json_scanner.re @@ -213,17 +213,13 @@ std: s->str_esc += 4; PHP_JSON_CONDITION_GOTO(STR_P1); } - <STR_P1>UTF16_3 { - s->str_esc += 3; - PHP_JSON_CONDITION_GOTO(STR_P1); - } <STR_P1>UTF16_4 { s->str_esc += 8; PHP_JSON_CONDITION_GOTO(STR_P1); } <STR_P1>UCS2 { - s->errcode = PHP_JSON_ERROR_UTF16; - return PHP_JSON_T_ERROR; + s->str_esc += 3; + PHP_JSON_CONDITION_GOTO(STR_P1); } <STR_P1>ESC { s->str_esc++; @@ -276,15 +272,6 @@ std: s->str_start = s->cursor; PHP_JSON_CONDITION_GOTO(STR_P2); } - <STR_P2>UTF16_3 { - int utf16 = php_json_ucs2_to_int(s, 4); - PHP_JSON_SCANNER_COPY_UTF(); - *(s->pstr++) = (char) (0xe0 | (utf16 >> 12)); - *(s->pstr++) = (char) (0x80 | ((utf16 >> 6) & 0x3f)); - *(s->pstr++) = (char) (0x80 | (utf16 & 0x3f)); - s->str_start = s->cursor; - PHP_JSON_CONDITION_GOTO(STR_P2); - } <STR_P2>UTF16_4 { int utf32, utf16_hi, utf16_lo; utf16_hi = php_json_ucs2_to_int(s, 4); @@ -298,6 +285,15 @@ std: s->str_start = s->cursor; PHP_JSON_CONDITION_GOTO(STR_P2); } + <STR_P2>UCS2 { + int utf16 = php_json_ucs2_to_int(s, 4); + PHP_JSON_SCANNER_COPY_UTF(); + *(s->pstr++) = (char) (0xe0 | (utf16 >> 12)); + *(s->pstr++) = (char) (0x80 | ((utf16 >> 6) & 0x3f)); + *(s->pstr++) = (char) (0x80 | (utf16 & 0x3f)); + s->str_start = s->cursor; + PHP_JSON_CONDITION_GOTO(STR_P2); + } <STR_P2>ESCPREF { char esc; PHP_JSON_SCANNER_COPY_ESC(); |