[Python-checkins] r60038 - python/trunk/Modules/_elementtree.c
christian.heimes
python-checkins at python.org
Fri Jan 18 09:04:57 CET 2008
Author: christian.heimes
Date: Fri Jan 18 09:04:57 2008
New Revision: 60038
Modified:
python/trunk/Modules/_elementtree.c
Log:
Coverity issue CID #182
size_error: Allocating 1 bytes to pointer "children", which needs at least 4 bytes
Modified: python/trunk/Modules/_elementtree.c
==============================================================================
--- python/trunk/Modules/_elementtree.c (original)
+++ python/trunk/Modules/_elementtree.c Fri Jan 18 09:04:57 2008
@@ -369,7 +369,17 @@
if (size > self->extra->allocated) {
/* use Python 2.4's list growth strategy */
size = (size >> 3) + (size < 9 ? 3 : 6) + size;
+ /* Coverity CID #182 size_error: Allocating 1 bytes to pointer "children"
+ * which needs at least 4 bytes.
+ * Although it's a false alarm always assume at least one child to
+ * be safe.
+ */
+ size = size ? size : 1;
if (self->extra->children != self->extra->_children) {
+ /* Coverity CID #182 size_error: Allocating 1 bytes to pointer
+ * "children", which needs at least 4 bytes. Although it's a
+ * false alarm always assume at least one child to be safe.
+ */
children = PyObject_Realloc(self->extra->children,
size * sizeof(PyObject*));
if (!children)
More information about the Python-checkins
mailing list