[Python-checkins] cpython: tracemalloc: fix usage of strtol(), value can be LONG_MIN or LONG_MAX on ERANGE
victor.stinner
python-checkins at python.org
Mon Dec 16 23:07:03 CET 2013
http://hg.python.org/cpython/rev/9885e0e85c7c
changeset: 88013:9885e0e85c7c
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Dec 16 23:06:19 2013 +0100
summary:
tracemalloc: fix usage of strtol(), value can be LONG_MIN or LONG_MAX on ERANGE
files:
Modules/_tracemalloc.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c
--- a/Modules/_tracemalloc.c
+++ b/Modules/_tracemalloc.c
@@ -1373,11 +1373,12 @@
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;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list