com php-src: Allow ill-formed unicode escapes in decoder: ext/json/json_scanner.re

From: Date: Sun, 04 Jan 2015 17:34:49 +0000
Subject: com php-src: Allow ill-formed unicode escapes in decoder: ext/json/json_scanner.re
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-84715@lists.php.net to get a copy of this message
Commit: 1119c4d2b210730e6c26f034e9769d116b26ceb1 Author: Jakub Zelenka <bukka@php.net> Sun, 4 Jan 2015 17:34:18 +0000 Parents: 32d54acd00cfff8f501c0761ffa662cf9556b60e Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1119c4d2b210730e6c26f034e9769d116b26ceb1 Log: Allow ill-formed unicode escapes in decoder Changed paths: M ext/json/json_scanner.re Diff: diff --git a/ext/json/json_scanner.re b/ext/json/json_scanner.re index 0592da8...b2add4b 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();

« previous php.cvs (#84715) next »