Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
928d3421
Commit
928d3421
authored
Apr 10, 2015
by
Milo Yip
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #290 from miloyip/issue288_QuoteInUnicodeEscape
Fix #288 double quote in unicode escape
parents
79e81fe3
b7e34100
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
reader.h
include/rapidjson/reader.h
+2
-0
readertest.cpp
test/unittest/readertest.cpp
+4
-0
No files found.
include/rapidjson/reader.h
View file @
928d3421
...
...
@@ -689,11 +689,13 @@ private:
}
else
if
(
e
==
'u'
)
{
// Unicode
unsigned
codepoint
=
ParseHex4
(
is
);
RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID
;
if
(
codepoint
>=
0xD800
&&
codepoint
<=
0xDBFF
)
{
// Handle UTF-16 surrogate pair
if
(
is
.
Take
()
!=
'\\'
||
is
.
Take
()
!=
'u'
)
RAPIDJSON_PARSE_ERROR
(
kParseErrorStringUnicodeSurrogateInvalid
,
is
.
Tell
()
-
2
);
unsigned
codepoint2
=
ParseHex4
(
is
);
RAPIDJSON_PARSE_ERROR_EARLY_RETURN_VOID
;
if
(
codepoint2
<
0xDC00
||
codepoint2
>
0xDFFF
)
RAPIDJSON_PARSE_ERROR
(
kParseErrorStringUnicodeSurrogateInvalid
,
is
.
Tell
()
-
2
);
codepoint
=
(((
codepoint
-
0xD800
)
<<
10
)
|
(
codepoint2
-
0xDC00
))
+
0x10000
;
...
...
test/unittest/readertest.cpp
View file @
928d3421
...
...
@@ -517,6 +517,10 @@ TEST(Reader, ParseString_Error) {
// Incorrect hex digit after \\u escape in string.
TEST_STRING_ERROR
(
kParseErrorStringUnicodeEscapeInvalidHex
,
"[
\"\\
uABCG
\"
]"
);
// Quotation in \\u escape in string (Issue #288)
TEST_STRING_ERROR
(
kParseErrorStringUnicodeEscapeInvalidHex
,
"[
\"\\
uaaa
\"
]"
);
TEST_STRING_ERROR
(
kParseErrorStringUnicodeEscapeInvalidHex
,
"[
\"\\
uD800
\\
uFFF
\"
]"
);
// The surrogate pair in string is invalid.
TEST_STRING_ERROR
(
kParseErrorStringUnicodeSurrogateInvalid
,
"[
\"\\
uD800X
\"
]"
);
TEST_STRING_ERROR
(
kParseErrorStringUnicodeSurrogateInvalid
,
"[
\"\\
uD800
\\
uFFFF
\"
]"
);
...
...
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