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
3fd4ab35
Commit
3fd4ab35
authored
Feb 07, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #17043: The unicode-internal decoder no longer read past the end of
input buffer.
parent
df4bb464
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
27 deletions
+27
-27
Misc/NEWS
Misc/NEWS
+3
-0
Objects/unicodeobject.c
Objects/unicodeobject.c
+24
-27
No files found.
Misc/NEWS
View file @
3fd4ab35
...
@@ -10,6 +10,9 @@ What's New in Python 3.2.4
...
@@ -10,6 +10,9 @@ What's New in Python 3.2.4
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #17043: The unicode-internal decoder no longer read past the end of
input buffer.
- Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder.
- Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder.
- Issue #10156: In the interpreter's initialization phase, unicode globals
- Issue #10156: In the interpreter's initialization phase, unicode globals
...
...
Objects/unicodeobject.c
View file @
3fd4ab35
...
@@ -4392,25 +4392,27 @@ PyObject *_PyUnicode_DecodeUnicodeInternal(const char *s,
...
@@ -4392,25 +4392,27 @@ PyObject *_PyUnicode_DecodeUnicodeInternal(const char *s,
end
=
s
+
size
;
end
=
s
+
size
;
while
(
s
<
end
)
{
while
(
s
<
end
)
{
memcpy
(
p
,
s
,
sizeof
(
Py_UNICODE
));
/* We have to sanity check the raw data, otherwise doom looms for
some malformed UCS-4 data. */
if
(
#ifdef Py_UNICODE_WIDE
*
p
>
unimax
||
*
p
<
0
||
#endif
end
-
s
<
Py_UNICODE_SIZE
)
{
startinpos
=
s
-
starts
;
if
(
end
-
s
<
Py_UNICODE_SIZE
)
{
if
(
end
-
s
<
Py_UNICODE_SIZE
)
{
endinpos
=
end
-
starts
;
endinpos
=
end
-
starts
;
reason
=
"truncated input"
;
reason
=
"truncated input"
;
goto
error
;
}
}
else
{
memcpy
(
p
,
s
,
sizeof
(
Py_UNICODE
));
#ifdef Py_UNICODE_WIDE
/* We have to sanity check the raw data, otherwise doom looms for
some malformed UCS-4 data. */
if
(
*
p
>
unimax
||
*
p
<
0
)
{
endinpos
=
s
-
starts
+
Py_UNICODE_SIZE
;
endinpos
=
s
-
starts
+
Py_UNICODE_SIZE
;
reason
=
"illegal code point (> 0x10FFFF)"
;
reason
=
"illegal code point (> 0x10FFFF)"
;
goto
error
;
}
}
#endif
p
++
;
s
+=
Py_UNICODE_SIZE
;
continue
;
error:
startinpos
=
s
-
starts
;
outpos
=
p
-
PyUnicode_AS_UNICODE
(
v
);
outpos
=
p
-
PyUnicode_AS_UNICODE
(
v
);
if
(
unicode_decode_call_errorhandler
(
if
(
unicode_decode_call_errorhandler
(
errors
,
&
errorHandler
,
errors
,
&
errorHandler
,
...
@@ -4420,11 +4422,6 @@ PyObject *_PyUnicode_DecodeUnicodeInternal(const char *s,
...
@@ -4420,11 +4422,6 @@ PyObject *_PyUnicode_DecodeUnicodeInternal(const char *s,
goto
onError
;
goto
onError
;
}
}
}
}
else
{
p
++
;
s
+=
Py_UNICODE_SIZE
;
}
}
if
(
_PyUnicode_Resize
(
&
v
,
p
-
PyUnicode_AS_UNICODE
(
v
))
<
0
)
if
(
_PyUnicode_Resize
(
&
v
,
p
-
PyUnicode_AS_UNICODE
(
v
))
<
0
)
goto
onError
;
goto
onError
;
...
...
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