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
91060f26
Commit
91060f26
authored
Aug 13, 2016
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Plain Diff
merge 3.4 (closes #27760)
parents
f17a8e9a
5295532a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
Misc/NEWS
Misc/NEWS
+2
-0
Modules/binascii.c
Modules/binascii.c
+15
-9
No files found.
Misc/NEWS
View file @
91060f26
...
...
@@ -40,6 +40,8 @@ Library
-
In
the
curses
module
,
raise
an
error
if
window
.
getstr
()
is
passed
a
negative
value
.
-
Issue
#
27760
:
Fix
possible
integer
overflow
in
binascii
.
b2a_qp
.
-
Issue
#
27758
:
Fix
possible
integer
overflow
in
the
_csv
module
for
large
record
lengths
.
...
...
Modules/binascii.c
View file @
91060f26
...
...
@@ -1383,6 +1383,7 @@ binascii_b2a_qp_impl(PyObject *module, Py_buffer *data, int quotetabs,
/* First, scan to see how many characters need to be encoded */
in
=
0
;
while
(
in
<
datalen
)
{
Py_ssize_t
delta
=
0
;
if
((
databuf
[
in
]
>
126
)
||
(
databuf
[
in
]
==
'='
)
||
(
header
&&
databuf
[
in
]
==
'_'
)
||
...
...
@@ -1397,12 +1398,12 @@ binascii_b2a_qp_impl(PyObject *module, Py_buffer *data, int quotetabs,
if
((
linelen
+
3
)
>=
MAXLINESIZE
)
{
linelen
=
0
;
if
(
crlf
)
odatalen
+=
3
;
delta
+=
3
;
else
odatalen
+=
2
;
delta
+=
2
;
}
linelen
+=
3
;
odatalen
+=
3
;
delta
+=
3
;
in
++
;
}
else
{
...
...
@@ -1414,11 +1415,11 @@ binascii_b2a_qp_impl(PyObject *module, Py_buffer *data, int quotetabs,
linelen
=
0
;
/* Protect against whitespace on end of line */
if
(
in
&&
((
databuf
[
in
-
1
]
==
' '
)
||
(
databuf
[
in
-
1
]
==
'\t'
)))
odatalen
+=
2
;
delta
+=
2
;
if
(
crlf
)
odatalen
+=
2
;
delta
+=
2
;
else
odatalen
+=
1
;
delta
+=
1
;
if
(
databuf
[
in
]
==
'\r'
)
in
+=
2
;
else
...
...
@@ -1430,15 +1431,20 @@ binascii_b2a_qp_impl(PyObject *module, Py_buffer *data, int quotetabs,
(
linelen
+
1
)
>=
MAXLINESIZE
)
{
linelen
=
0
;
if
(
crlf
)
odatalen
+=
3
;
delta
+=
3
;
else
odatalen
+=
2
;
delta
+=
2
;
}
linelen
++
;
odatalen
++
;
delta
++
;
in
++
;
}
}
if
(
PY_SSIZE_T_MAX
-
delta
<
odatalen
)
{
PyErr_NoMemory
();
return
NULL
;
}
odatalen
+=
delta
;
}
/* We allocate the output same size as input, this is overkill.
...
...
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