diff options
author | Steve Dower <steve.dower@microsoft.com> | 2017-02-04 15:05:40 -0800 |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2017-02-04 15:05:40 -0800 |
commit | b2fa705fd3887c326e811c418469c784353027f4 (patch) | |
tree | b3428f73de91453edbfd4df1a5d4a212d182eb44 /Python/asdl.c | |
parent | 134e58fd3aaa2e91390041e143f3f0a21a60142b (diff) | |
parent | b53654b6dbfce8318a7d4d1cdaddca7a7fec194b (diff) | |
download | cpython-b2fa705fd3887c326e811c418469c784353027f4.tar.gz |
Issue #29392: Prevent crash when passing invalid arguments into msvcrt module.
Diffstat (limited to 'Python/asdl.c')
-rw-r--r-- | Python/asdl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/asdl.c b/Python/asdl.c index df387b2119..c211078118 100644 --- a/Python/asdl.c +++ b/Python/asdl.c @@ -9,14 +9,14 @@ _Py_asdl_seq_new(Py_ssize_t size, PyArena *arena) /* check size is sane */ if (size < 0 || - (size && (((size_t)size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { + (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) { PyErr_NoMemory(); return NULL; } n = (size ? (sizeof(void *) * (size - 1)) : 0); /* check if size can be added safely */ - if (n > PY_SIZE_MAX - sizeof(asdl_seq)) { + if (n > SIZE_MAX - sizeof(asdl_seq)) { PyErr_NoMemory(); return NULL; } @@ -40,14 +40,14 @@ _Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena) /* check size is sane */ if (size < 0 || - (size && (((size_t)size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { + (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) { PyErr_NoMemory(); return NULL; } n = (size ? (sizeof(void *) * (size - 1)) : 0); /* check if size can be added safely */ - if (n > PY_SIZE_MAX - sizeof(asdl_seq)) { + if (n > SIZE_MAX - sizeof(asdl_seq)) { PyErr_NoMemory(); return NULL; } |