mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
tracemalloc: fix usage of strtol(), value can be LONG_MIN or LONG_MAX on ERANGE
This commit is contained in:
parent
4d8c29cd57
commit
711e27cd50
1 changed files with 2 additions and 1 deletions
|
@ -1373,11 +1373,12 @@ _PyTraceMalloc_Init(void)
|
|||
char *endptr = p;
|
||||
long value;
|
||||
|
||||
errno = 0;
|
||||
value = strtol(p, &endptr, 10);
|
||||
if (*endptr != '\0'
|
||||
|| value < 1
|
||||
|| value > MAX_NFRAME
|
||||
|| (errno == ERANGE && value == ULONG_MAX))
|
||||
|| errno == ERANGE)
|
||||
{
|
||||
Py_FatalError("PYTHONTRACEMALLOC: invalid number of frames");
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue