AUDIT: r22703 - gnucash/trunk/src/backend/xml - Bug #672364 - does not properly handle XML parse errors, leading to
Geert Janssens
gjanssens at code.gnucash.org
Tue Jan 15 11:15:57 EST 2013
Author: gjanssens
Date: 2013-01-15 11:15:57 -0500 (Tue, 15 Jan 2013)
New Revision: 22703
Trac: http://svn.gnucash.org/trac/changeset/22703
Modified:
gnucash/trunk/src/backend/xml/sixtp.c
Log:
Bug #672364 - does not properly handle XML parse errors, leading to
possible data loss
Handle return value of xmlParseDocument()
Ignoring errors can lead to data loss.
Author: Sébastien Villemot <sebastien at debian.org>
Bug-Debian: http://bugs.debian.org/696282
BP
Modified: gnucash/trunk/src/backend/xml/sixtp.c
===================================================================
--- gnucash/trunk/src/backend/xml/sixtp.c 2013-01-14 01:20:09 UTC (rev 22702)
+++ gnucash/trunk/src/backend/xml/sixtp.c 2013-01-15 16:15:57 UTC (rev 22703)
@@ -695,6 +695,7 @@
gpointer *parse_result)
{
sixtp_parser_context *ctxt;
+ int parse_ret;
if (!(ctxt = sixtp_context_new(sixtp, global_data, data_for_top_level)))
{
@@ -706,12 +707,12 @@
ctxt->data.saxParserCtxt->sax = &ctxt->handler;
ctxt->data.saxParserCtxt->userData = &ctxt->data;
ctxt->data.bad_xml_parser = sixtp_dom_parser_new(gnc_bad_xml_end_handler, NULL, NULL);
- xmlParseDocument( ctxt->data.saxParserCtxt );
+ parse_ret = xmlParseDocument( ctxt->data.saxParserCtxt );
//xmlSAXUserParseFile(&ctxt->handler, &ctxt->data, filename);
sixtp_context_run_end_handler(ctxt);
- if (ctxt->data.parsing_ok)
+ if (parse_ret == 0 && ctxt->data.parsing_ok)
{
if (parse_result)
*parse_result = ctxt->top_frame->frame_data;
More information about the gnucash-changes
mailing list