mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #16096: Fix several occurrences of potential signed integer overflow. Thanks Serhiy Storchaka.
This commit is contained in:
parent
a2028733ef
commit
c04ddff290
7 changed files with 30 additions and 35 deletions
|
@ -284,7 +284,8 @@ random_seed(RandomObject *self, PyObject *args)
|
|||
n = newn;
|
||||
if (keyused >= keymax) {
|
||||
unsigned long bigger = keymax << 1;
|
||||
if ((bigger >> 1) != keymax) {
|
||||
if ((bigger >> 1) != keymax ||
|
||||
bigger > PY_SSIZE_T_MAX / sizeof(*key)) {
|
||||
PyErr_NoMemory();
|
||||
goto Done;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue