diff --git a/fbson/FbsonJsonParser.h b/fbson/FbsonJsonParser.h index 06dce59fd7f2..c39cb2183eb8 100644 --- a/fbson/FbsonJsonParser.h +++ b/fbson/FbsonJsonParser.h @@ -503,7 +503,7 @@ class FbsonJsonParserT { For DC00 to DFFF, it should be low surrogates for UTF16. So if it display in the high bits, it's invalid. */ - if ((uc >= 0xDC00 && uc <= 0xDFFF) || uc==0){ + if (uc >= 0xDC00 && uc <= 0xDFFF){ return false; } diff --git a/mysql-test/suite/json/r/type_document_innodb.result b/mysql-test/suite/json/r/type_document_innodb.result index f882a4a3496a..1d1d304fcb05 100644 --- a/mysql-test/suite/json/r/type_document_innodb.result +++ b/mysql-test/suite/json/r/type_document_innodb.result @@ -214,6 +214,8 @@ insert into t4 values(3, "{\"\\b\\f\\n\\r\\t\":\"123\\t\\r\\n\\f\\bABC\"}", "esc insert into t4 values(4, "{\"Status\":\"\\u675f\\u5e26\\u7ed3\\u53d1\\u523b\\u5f55\\u673a\\u5076\\u5c14\\u4e94\\u798f\\u805a\\u54e6\"}", "escape of Unicode"); insert into t4 values(5, "{\"\\u0009\":\"\\u000d\\u000a\"}", "escape of Unicode for control char"); insert into t4 values(6, "{\"Control\":\"\\u0002\"}", "escape of Unicode for control char"); +insert into t4 values(7, "{\"NULL\":\"\\u0000\"}", "Unicode for NULL"); +insert into t4 values(8, '{"NULL":"\\u0000"}', "Unicode for NULL"); select * from t4; i a s 1 {"Name":"Json\tXia"} escape in value @@ -222,6 +224,8 @@ i a s 4 {"Status":"束带结发刻录机偶尔五福聚哦"} escape of Unicode 5 {"\t":"\r\n"} escape of Unicode for control char 6 {"Control":"\u0002"} escape of Unicode for control char +7 {"NULL":""} Unicode for NULL +8 {"NULL":""} Unicode for NULL create table t5 (i int(8), a document, s text(255)) engine = innodb; insert into t5 values(1, "{\"BAD\":\"123\\u0xDFFE\"}", "Bad Unicode"); ERROR HY000: Invalid document value: '{"BAD":"123\u0xDFFE"}', pos 14, error 'Invalid string value' diff --git a/mysql-test/suite/json/t/type_document_innodb.test b/mysql-test/suite/json/t/type_document_innodb.test index d81a2fb4d634..78455aee7c07 100644 --- a/mysql-test/suite/json/t/type_document_innodb.test +++ b/mysql-test/suite/json/t/type_document_innodb.test @@ -211,6 +211,8 @@ insert into t4 values(3, "{\"\\b\\f\\n\\r\\t\":\"123\\t\\r\\n\\f\\bABC\"}", "esc insert into t4 values(4, "{\"Status\":\"\\u675f\\u5e26\\u7ed3\\u53d1\\u523b\\u5f55\\u673a\\u5076\\u5c14\\u4e94\\u798f\\u805a\\u54e6\"}", "escape of Unicode"); insert into t4 values(5, "{\"\\u0009\":\"\\u000d\\u000a\"}", "escape of Unicode for control char"); insert into t4 values(6, "{\"Control\":\"\\u0002\"}", "escape of Unicode for control char"); +insert into t4 values(7, "{\"NULL\":\"\\u0000\"}", "Unicode for NULL"); +insert into t4 values(8, '{"NULL":"\\u0000"}', "Unicode for NULL"); select * from t4; # Test FBSon with wrong escape