From 51ae4921b30ab48bd31976fc4f92345b1bd26f50 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Sat, 31 Oct 2009 12:47:47 +0000 Subject: [PATCH] Set retval on PyOS_string_to_double failure. --- Python/marshal.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Python/marshal.c b/Python/marshal.c index 865a0c8871..c7015d2eb7 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -699,8 +699,10 @@ r_object(RFILE *p) } buf[n] = '\0'; dx = PyOS_string_to_double(buf, NULL, NULL); - if (dx == -1.0 && PyErr_Occurred()) + if (dx == -1.0 && PyErr_Occurred()) { + retval = NULL; break; + } retval = PyFloat_FromDouble(dx); break; } @@ -738,8 +740,10 @@ r_object(RFILE *p) } buf[n] = '\0'; c.real = PyOS_string_to_double(buf, NULL, NULL); - if (c.real == -1.0 && PyErr_Occurred()) + if (c.real == -1.0 && PyErr_Occurred()) { + retval = NULL; break; + } n = r_byte(p); if (n == EOF || r_string(buf, (int)n, p) != n) { PyErr_SetString(PyExc_EOFError, @@ -749,8 +753,10 @@ r_object(RFILE *p) } buf[n] = '\0'; c.imag = PyOS_string_to_double(buf, NULL, NULL); - if (c.imag == -1.0 && PyErr_Occurred()) + if (c.imag == -1.0 && PyErr_Occurred()) { + retval = NULL; break; + } retval = PyComplex_FromCComplex(c); break; } -- 2.40.0