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
cd8799f0
Commit
cd8799f0
authored
May 23, 2012
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #14888: Fix misbehaviour of the _md5 module when called on data larger than 2**32 bytes.
parent
d68ffdb4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
Misc/NEWS
Misc/NEWS
+3
-0
Modules/md5module.c
Modules/md5module.c
+14
-3
No files found.
Misc/NEWS
View file @
cd8799f0
...
...
@@ -64,6 +64,9 @@ Core and Builtins
Library
-------
-
Issue
#
14888
:
Fix
misbehaviour
of
the
_md5
module
when
called
on
data
larger
than
2
**
32
bytes
.
-
Issue
#
14875
:
Use
float
(
'inf'
)
instead
of
float
(
'1e66666'
)
in
the
json
module
.
-
Issue
#
14572
:
Prevent
build
failures
with
pre
-
3.5.0
versions
of
...
...
Modules/md5module.c
View file @
cd8799f0
...
...
@@ -262,6 +262,8 @@ MD5_new(PyObject *self, PyObject *args)
{
md5object
*
md5p
;
Py_buffer
view
=
{
0
};
Py_ssize_t
n
;
unsigned
char
*
buf
;
if
(
!
PyArg_ParseTuple
(
args
,
"|s*:new"
,
&
view
))
return
NULL
;
...
...
@@ -271,9 +273,18 @@ MD5_new(PyObject *self, PyObject *args)
return
NULL
;
}
if
(
view
.
len
>
0
)
{
md5_append
(
&
md5p
->
md5
,
(
unsigned
char
*
)
view
.
buf
,
Py_SAFE_DOWNCAST
(
view
.
len
,
Py_ssize_t
,
unsigned
int
));
n
=
view
.
len
;
buf
=
(
unsigned
char
*
)
view
.
buf
;
while
(
n
>
0
)
{
Py_ssize_t
nbytes
;
if
(
n
>
INT_MAX
)
nbytes
=
INT_MAX
;
else
nbytes
=
n
;
md5_append
(
&
md5p
->
md5
,
buf
,
Py_SAFE_DOWNCAST
(
nbytes
,
Py_ssize_t
,
unsigned
int
));
buf
+=
nbytes
;
n
-=
nbytes
;
}
PyBuffer_Release
(
&
view
);
...
...
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