DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24535>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24535 Memory allocation problem in MemBufInputSource class Summary: Memory allocation problem in MemBufInputSource class Product: Xerces-C++ Version: 2.3.0 Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Miscellaneous AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] This code fails (with Segmentation fault on my system): ------------------------------------------------------- char s[] = "<bla> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx </bla>"; { MemBufInputSource::MemBufInputSource xObj( (const XMLByte*)s,strlen (s),"hello", true ); } This code doesn't fail: ----------------------- char s[] = "<bla> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx </bla>"; XMLByte *p = new XMLByte[strlen(s)]; memcpy( (char*)p, s, strlen(s) ); { MemBufInputSource::MemBufInputSource xObj( p,strlen(s),"hello", true ); } The reason: ----------- If last parameter of MemBufInputSource class constructor was true, MemBufInputSource class destructor deallocates fSrcBytes buffer (member): MemBufInputSource::~MemBufInputSource() { if (fAdopted) delete [] (XMLByte*)fSrcBytes; } But this buffer is allocated nowhere. I think class contructor should allocate it and fill it with data specified by first and second parameters. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
