From 711e27cd503933cfe7a42d931d2b69dc79014ae0 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 16 Dec 2013 23:06:19 +0100 Subject: tracemalloc: fix usage of strtol(), value can be LONG_MIN or LONG_MAX on ERANGE --- Modules/_tracemalloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 7e6113d..f8ce766 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -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; -- cgit v0.12