Empty XML file causing segmentation fault
Simple, lightweight XML parser in C, statically or dynamically linked.
Brought to you by:
matthieu-labas
Hi Matthieu,
in the this code , the segmentation fault error occurred in this line : node = XMLDoc_root(&doc);
if (!XMLDoc_parse_file_DOM(C2SX(xmlPath), &doc)) {
trace_error("Error while loading XML File : %s\n",xmlPath);
return;
}
node = XMLDoc_root(&doc);
I fixed this bug by checking the root node
if(doc.i_root==-1){
trace_error("XML document is empty: %s\n",xmlPath);
}
node = XMLDoc_root(&doc);
thanks to check empty file in the function XMLDoc_parse_file_DOM
Hi ElOualid,
Thank you for the report. However I can't find such reference in the code.
Can you tell me which version you're using and which file and line number you got the error?
Thanks!
Matthieu
Hi Matthieu,
Excuse me for delayed reply
I am using the VERSION "4.3.3"
The error appeared in the line node = XMLDoc_root(&doc); this error caused by reading empty xml file
OK thanks. I changed the macro to check for the
i_rootvalidity and returNULLif< 0.I pushed the changes to v4.3.4.