[ expat-Bugs-496505 ] checking for malloc failures

noreply@sourceforge.net noreply@sourceforge.net
Mon Dec 24 08:38:02 2001


Bugs item #496505, was opened at 2001-12-24 08:37
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=496505&group_id=10127

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Eric C. Newton (ericnewton)
Assigned to: Nobody/Anonymous (nobody)
Summary: checking for malloc failures

Initial Comment:
expat 1.95.2 (under RedHat linux 2.4)

The following code (xmlparse.c:578) will crash, should
the malloc() call fail:

    XML_Memory_Handling_Suite *mtemp;
    parser = malloc(sizeof(Parser));
    mtemp = &(((Parser *) parser)->m_mem);
    mtemp->malloc_fcn = malloc;


Likewise (xmlparse.c:1139) XML_GetBuffer() returns NULL
when malloc() fails, and the result is not checked:

    memcpy(XML_GetBuffer(parser, len), s, len);

Other than that, expat works quite well.  Very nice
library.

-Eric


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=496505&group_id=10127