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
4b168183
Commit
4b168183
authored
Oct 04, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #22518: Fixed integer overflow issues in "backslashreplace",
"xmlcharrefreplace", and "surrogatepass" error handlers.
parent
76e73f85
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
Misc/NEWS
Misc/NEWS
+3
-0
Python/codecs.c
Python/codecs.c
+6
-2
No files found.
Misc/NEWS
View file @
4b168183
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.3.6?
Core and Builtins
-----------------
- Issue #22518: Fixed integer overflow issues in "backslashreplace",
"xmlcharrefreplace", and "surrogatepass" error handlers.
- Issue #22520: Fix overflow checking when generating the repr of a unicode
object.
...
...
Python/codecs.c
View file @
4b168183
...
...
@@ -727,7 +727,7 @@ PyObject *PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
Py_ssize_t
end
;
PyObject
*
res
;
unsigned
char
*
outp
;
in
t
ressize
;
Py_ssize_
t
ressize
;
Py_UCS4
ch
;
if
(
PyUnicodeEncodeError_GetStart
(
exc
,
&
start
))
return
NULL
;
...
...
@@ -735,6 +735,8 @@ PyObject *PyCodec_XMLCharRefReplaceErrors(PyObject *exc)
return
NULL
;
if
(
!
(
object
=
PyUnicodeEncodeError_GetObject
(
exc
)))
return
NULL
;
if
(
end
-
start
>
PY_SSIZE_T_MAX
/
(
2
+
7
+
1
))
end
=
start
+
PY_SSIZE_T_MAX
/
(
2
+
7
+
1
);
for
(
i
=
start
,
ressize
=
0
;
i
<
end
;
++
i
)
{
/* object is guaranteed to be "ready" */
ch
=
PyUnicode_READ_CHAR
(
object
,
i
);
...
...
@@ -823,7 +825,7 @@ PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc)
Py_ssize_t
end
;
PyObject
*
res
;
unsigned
char
*
outp
;
in
t
ressize
;
Py_ssize_
t
ressize
;
Py_UCS4
c
;
if
(
PyUnicodeEncodeError_GetStart
(
exc
,
&
start
))
return
NULL
;
...
...
@@ -831,6 +833,8 @@ PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc)
return
NULL
;
if
(
!
(
object
=
PyUnicodeEncodeError_GetObject
(
exc
)))
return
NULL
;
if
(
end
-
start
>
PY_SSIZE_T_MAX
/
(
1
+
1
+
8
))
end
=
start
+
PY_SSIZE_T_MAX
/
(
1
+
1
+
8
);
for
(
i
=
start
,
ressize
=
0
;
i
<
end
;
++
i
)
{
/* object is guaranteed to be "ready" */
c
=
PyUnicode_READ_CHAR
(
object
,
i
);
...
...
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