tracemalloc: fix usage of strtol(), value can be LONG_MIN or LONG_MAX on ERANGE
This commit is contained in:
parent
4d8c29cd57
commit
711e27cd50
|
@ -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…
Reference in New Issue