]> granicus.if.org Git - python/commitdiff
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
authorNeal Norwitz <nnorwitz@gmail.com>
Fri, 12 Oct 2007 03:05:19 +0000 (03:05 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Fri, 12 Oct 2007 03:05:19 +0000 (03:05 +0000)
would be accessed.

Will backport.

Python/marshal.c

index eac4616cc569580f3de57dfa60fe394bc2005007..897c15ec8ad26424734f43eb3fe1a4ea22ce29e5 100644 (file)
@@ -1013,6 +1013,7 @@ PyMarshal_ReadLongFromFile(FILE *fp)
        RFILE rf;
        rf.fp = fp;
        rf.strings = NULL;
+       rf.ptr = rf.end = NULL;
        return r_long(&rf);
 }
 
@@ -1086,6 +1087,7 @@ PyMarshal_ReadObjectFromFile(FILE *fp)
        rf.fp = fp;
        rf.strings = PyList_New(0);
        rf.depth = 0;
+       rf.ptr = rf.end = NULL;
        result = r_object(&rf);
        Py_DECREF(rf.strings);
        return result;