]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
tracemalloc: fix usage of strtol(), value can be LONG_MIN or LONG_MAX on ERANGE
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 16 Dec 2013 22:06:19 +0000 (23:06 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 16 Dec 2013 22:06:19 +0000 (23:06 +0100)
Modules/_tracemalloc.c

index 7e6113dc1ae20596b5afd513256c3991c887894e..f8ce76625181c45b0e2bd2111440ac75356e1c56 100644 (file)
@@ -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;