After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 719550 - rest-xml-parser: Ignore text content at the top-level of a document
rest-xml-parser: Ignore text content at the top-level of a document
Status: RESOLVED FIXED
Product: librest
Classification: Platform
Component: xml-parser
git master
Other All
: Normal major
: ---
Assigned To: librest-maint
librest-maint
Depends on:
Blocks:
 
 
Reported: 2013-11-29 12:48 UTC by Philip Withnall
Modified: 2015-04-14 18:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rest-xml-parser: Ignore text content at the top-level of a document (1.37 KB, patch)
2013-11-29 12:48 UTC, Philip Withnall
committed Details | Review
rest-xml-parser: Ignore text content at the top-level of a document (1.37 KB, patch)
2015-04-14 18:04 UTC, Philip Withnall
committed Details | Review

Description Philip Withnall 2013-11-29 12:48:31 UTC
Found by scan-build.
Comment 1 Philip Withnall 2013-11-29 12:48:50 UTC
Created attachment 263117 [details] [review]
rest-xml-parser: Ignore text content at the top-level of a document

This prevents a crash due to cur_node being NULL.

Found by scan-build.
Comment 2 Christophe Fergeau 2015-03-17 14:13:16 UTC
Review of attachment 263117 [details] [review]:

This is not far from being something that could be a g_assert() as after asking DV, we can't get a _TEXT node before getting an _ELEMENT node.

::: rest/rest-xml-parser.c
@@ +201,3 @@
+                   cur_node->content);
+        } else {
+          REST_DEBUG (XML_PARSER, "Text content ignored at top level.");

Without going as far as having a g_assert(), let's make this a g_warning or g_critical as this theoritically can't happen regardless of what we are parsing.
Comment 3 Philip Withnall 2015-04-14 18:04:18 UTC
Pushed with a change from REST_DEBUG to g_warning().

The following fix has been pushed:
11b2b07 rest-xml-parser: Ignore text content at the top-level of a document
Comment 4 Philip Withnall 2015-04-14 18:04:22 UTC
Created attachment 301567 [details] [review]
rest-xml-parser: Ignore text content at the top-level of a document

This prevents a crash due to cur_node being NULL.

Found by scan-build.