[Python-checkins] r52178 - python/branches/release24-maint/Python/marshal.c
andrew.kuchling
python-checkins at python.org
Thu Oct 5 21:08:30 CEST 2006
Author: andrew.kuchling
Date: Thu Oct 5 21:08:30 2006
New Revision: 52178
Modified:
python/branches/release24-maint/Python/marshal.c
Log:
[Backport r51221 | neal.norwitz -- the original commit message is wrong;
this code is only used if WITHOUT_COMPLEX is *not* defined, which is the
common case for Python builds.]
This code is actually not used unless WITHOUT_COMPLEX is defined.
However, there was no error checking that PyFloat_FromDouble returned
a valid pointer. I believe this change is correct as it seemed
to follow other code in the area.
Klocwork # 292.
Modified: python/branches/release24-maint/Python/marshal.c
==============================================================================
--- python/branches/release24-maint/Python/marshal.c (original)
+++ python/branches/release24-maint/Python/marshal.c Thu Oct 5 21:08:30 2006
@@ -177,6 +177,10 @@
w_byte(TYPE_COMPLEX, p);
temp = (PyFloatObject*)PyFloat_FromDouble(
PyComplex_RealAsDouble(v));
+ if (!temp) {
+ p->error = 1;
+ return;
+ }
PyFloat_AsReprString(buf, temp);
Py_DECREF(temp);
n = strlen(buf);
@@ -184,6 +188,10 @@
w_string(buf, n, p);
temp = (PyFloatObject*)PyFloat_FromDouble(
PyComplex_ImagAsDouble(v));
+ if (!temp) {
+ p->error = 1;
+ return;
+ }
PyFloat_AsReprString(buf, temp);
Py_DECREF(temp);
n = strlen(buf);
More information about the Python-checkins
mailing list