Commit f81d153a authored by Victor Stinner's avatar Victor Stinner

tracemalloc: fix usage of strtol(), value can be LONG_MIN or LONG_MAX on ERANGE

parent eff76ca2
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment