summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Kaseorg <andersk@mit.edu>2016-08-17 17:13:41 -0400
committerRichard Hughes <richard@hughsie.com>2016-08-17 22:13:41 +0100
commit8094e1246e8d7ed827784c3c3126cef44a9ef699 (patch)
treef0bc56c5a86c39d858c0d2afd05819b0c51b1f27
parent2ec31bac7bd77e7b39c502276f4acec21ed9d576 (diff)
downloadappstream-glib-8094e1246e8d7ed827784c3c3126cef44a9ef699.tar.gz
Pay attention to errors from yaml_parser_parse (#129)
The previous commit message blames libyaml for spinning forever on invalid input. This is not the case. libyaml is correctly returning an error code, but as_node_yaml_process_layer was ignoring it and spinning forever calling back into libyaml as if expecting the error to disappear by itself. The code should probably be audited for other ignored error codes, but this fixes the immediate problem. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
-rw-r--r--libappstream-glib/as-yaml.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libappstream-glib/as-yaml.c b/libappstream-glib/as-yaml.c
index e0c9c3f..bfb955c 100644
--- a/libappstream-glib/as-yaml.c
+++ b/libappstream-glib/as-yaml.c
@@ -211,8 +211,7 @@ as_node_yaml_process_layer (yaml_parser_t *parser, AsNode *parent)
gboolean valid = TRUE;
yaml_event_t event;
- while (valid) {
- yaml_parser_parse (parser, &event);
+ while (valid && yaml_parser_parse (parser, &event)) {
switch (event.type) {
case YAML_SCALAR_EVENT:
tmp = (const gchar *) event.data.scalar.value;