This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Need a look for return value checking [_elementtree.c]
Type: crash Stage: resolved
Components: XML Versions: Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: alexc, xiang.zhang
Priority: normal Keywords:

Created on 2017-03-22 03:39 by alexc, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 757 merged xiang.zhang, 2017-03-22 04:13
Messages (3)
msg289965 - (view) Author: Alex CHEN (alexc) Date: 2017-03-22 03:39
In file _elementtree.c

our static code scanner has reported this case, but I don't sure that could be any problem, may you have a look?

static PyObject*  
element_getattr(ElementObject* self, char* name)
    PyObject* res;

    /* handle common attributes first */
    if (strcmp(name, "tag") == 0) {
        res = self->tag;
        return res;
    } else if (strcmp(name, "text") == 0) {
        res = element_get_text(self);         // is it possible that element_get_text could return NULL here?
        return res;
msg289969 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-03-22 04:26
Fixed. Thanks for your report Alex.
msg290117 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-03-24 20:09
New changeset 827c78326aa850257ca40991b401b3db298c54fb by Xiang Zhang in branch '2.7':
bpo-29873: fix INCREF for possible NULL value in element_getattr() (GH-757)
Date User Action Args
2022-04-11 14:58:44adminsetgithub: 74059
2017-03-24 20:09:24xiang.zhangsetmessages: + msg290117
2017-03-22 04:26:27xiang.zhangsetstatus: open -> closed

nosy: + xiang.zhang
messages: + msg289969

resolution: fixed
stage: resolved
2017-03-22 04:13:49xiang.zhangsetpull_requests: + pull_request671
2017-03-22 03:39:35alexccreate