Message289972
In file _elementtree.c
our static code scanner has reported this case, I think there is a bit similar to http://bugs.python.org/issue29874 (returns NULL when NoMemory)
static PyObject*
subelement(PyObject* self, PyObject* args, PyObject* kw)
{
PyObject* elem;
ElementObject* parent;
PyObject* tag;
PyObject* attrib = NULL;
if (!PyArg_ParseTuple(args, "O!O|O!:SubElement",
&Element_Type, &parent, &tag,
&PyDict_Type, &attrib))
return NULL;
if (attrib || kw) {
attrib = (attrib) ? PyDict_Copy(attrib) : PyDict_New();
if (!attrib)
return NULL;
if (kw)
PyDict_Update(attrib, kw);
} else {
Py_INCREF(Py_None);
attrib = Py_None;
}
elem = element_new(tag, attrib); // <== element_new could returns a NULL pointer, the followed Py_DECREF(elem) would dereference NULL pointer.
Py_DECREF(attrib);
if (element_add_subelement(parent, elem) < 0) {
Py_DECREF(elem);
return NULL;
} |
|
Date |
User |
Action |
Args |
2017-03-22 05:52:24 | alexc | set | recipients:
+ alexc |
2017-03-22 05:52:24 | alexc | set | messageid: <1490161944.61.0.295678924414.issue29876@psf.upfronthosting.co.za> |
2017-03-22 05:52:24 | alexc | link | issue29876 messages |
2017-03-22 05:52:24 | alexc | create | |
|