Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ac93bc25
Commit
ac93bc25
authored
Jun 26, 2001
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When decoding UTF-16, don't assume that the buffer is in native endianness
when checking surrogates.
parent
208efe56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
Objects/unicodeobject.c
Objects/unicodeobject.c
+4
-4
No files found.
Objects/unicodeobject.c
View file @
ac93bc25
...
...
@@ -1065,16 +1065,16 @@ PyObject *PyUnicode_DecodeUTF16(const char *s,
errmsg
=
"unexpected end of data"
;
goto
utf16Error
;
}
if
(
0xD
C00
<=
*
q
&&
*
q
<=
0xDF
FF
)
{
if
(
0xD
800
<=
ch
&&
ch
<=
0xDB
FF
)
{
Py_UCS2
ch2
=
*
q
++
;
#ifdef BYTEORDER_IS_LITTLE_ENDIAN
if
(
bo
==
1
)
ch
=
(
ch
>>
8
)
|
(
ch
<<
8
);
ch
2
=
(
ch2
>>
8
)
|
(
ch2
<<
8
);
#else
if
(
bo
==
-
1
)
ch
=
(
ch
>>
8
)
|
(
ch
<<
8
);
ch
2
=
(
ch2
>>
8
)
|
(
ch2
<<
8
);
#endif
if
(
0xD
800
<=
ch
&&
ch
<=
0xDB
FF
)
{
if
(
0xD
C00
<=
ch2
&&
ch2
<=
0xDF
FF
)
{
#if Py_UNICODE_SIZE == 2
/* This is valid data (a UTF-16 surrogate pair), but
we are not able to store this information since our
...
...
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