mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-34922: Fix integer overflow in the digest() and hexdigest() methods (GH-9751)
for the SHAKE algorithm in the hashlib module.
This commit is contained in:
parent
f1aa8aed4a
commit
9b8c2e7676
3 changed files with 20 additions and 0 deletions
|
@ -589,6 +589,10 @@ _SHAKE_digest(SHA3object *self, unsigned long digestlen, int hex)
|
|||
int res;
|
||||
PyObject *result = NULL;
|
||||
|
||||
if (digestlen >= (1 << 29)) {
|
||||
PyErr_SetString(PyExc_ValueError, "length is too large");
|
||||
return NULL;
|
||||
}
|
||||
/* ExtractLane needs at least SHA3_MAX_DIGESTSIZE + SHA3_LANESIZE and
|
||||
* SHA3_LANESIZE extra space.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue