Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
9554ef06
Commit
9554ef06
authored
Sep 12, 2019
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-19670 json escaped unicode parse error.
Fixed 4-byte length characters handled incorrectly.
parent
0fa5ad3a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
mysql-test/main/func_json.result
mysql-test/main/func_json.result
+9
-0
mysql-test/main/func_json.test
mysql-test/main/func_json.test
+7
-0
strings/json_lib.c
strings/json_lib.c
+3
-1
No files found.
mysql-test/main/func_json.result
View file @
9554ef06
...
...
@@ -942,5 +942,14 @@ def json_depnth 3 10 1 N 32897 0 63
json_length json_depnth
2 3
#
# MDEV-19670 json escaped unicode parse error
#
SELECT json_valid('{"value":"\\ud83d\\ude0a"}');
json_valid('{"value":"\\ud83d\\ude0a"}')
1
SELECT json_valid('{"test": "\\ud83d\\ude0b"}');
json_valid('{"test": "\\ud83d\\ude0b"}')
1
#
# End of 10.3 tests
#
mysql-test/main/func_json.test
View file @
9554ef06
...
...
@@ -561,6 +561,13 @@ SELECT
--
enable_ps_protocol
--
disable_metadata
--
echo
#
--
echo
# MDEV-19670 json escaped unicode parse error
--
echo
#
SELECT
json_valid
(
'{"value":"\\ud83d\\ude0a"}'
);
SELECT
json_valid
(
'{"test": "\\ud83d\\ude0b"}'
);
--
echo
#
--
echo
# End of 10.3 tests
--
echo
#
strings/json_lib.c
View file @
9554ef06
...
...
@@ -320,15 +320,17 @@ static int json_handle_esc(json_string_t *s)
if
(
s
->
c_next
!=
'\\'
)
return
s
->
error
=
JE_SYN
;
s
->
c_str
+=
c_len
;
if
((
c_len
=
json_next_char
(
s
))
<=
0
)
return
s
->
error
=
json_eos
(
s
)
?
JE_EOS
:
JE_BAD_CHR
;
if
(
s
->
c_next
!=
'u'
)
return
s
->
error
=
JE_SYN
;
s
->
c_str
+=
c_len
;
if
(
read_4_hexdigits
(
s
,
code
+
2
))
return
1
;
if
((
c_len
=
my_utf16_uni
(
0
,
&
s
->
c_next
,
code
,
code
+
4
))
==
2
)
if
((
c_len
=
my_utf16_uni
(
0
,
&
s
->
c_next
,
code
,
code
+
4
))
==
4
)
return
0
;
}
return
s
->
error
=
JE_BAD_CHR
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment