[telepathy-logger-0.8] telepathy-logger: log-iter-xml: Fix crash when logs are corrupted or invalid XML
Debarshi Ray
debarshir at kemper.freedesktop.org
Tue Apr 28 09:50:11 PDT 2015
Module: telepathy-logger
Branch: telepathy-logger-0.8
Commit: 560a9b76613907f693e3a8c105a8a51cb09f10f5
URL: http://cgit.freedesktop.org/telepathy/telepathy-logger/commit/?id=560a9b76613907f693e3a8c105a8a51cb09f10f5
Author: Debarshi Ray <debarshir at freedesktop.org>
Date: Fri Apr 17 18:28:20 2015 +0200
log-iter-xml: Fix crash when logs are corrupted or invalid XML
Chances of _tpl_log_store_get_events_for_date returning NULL due to an
invalid XML file are lower because we ask libxml2 (since commit
734af80691) to recover from errors if possible. Even then, it doesn't
hurt to defend against this eventuality.
Thanks to Daniel Thompson for catching this!
https://bugs.freedesktop.org/show_bug.cgi?id=89595
(cherry picked from commit 711842911edb15977430c0b6c1803e947619efc3)
---
telepathy-logger/log-iter-xml.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/telepathy-logger/log-iter-xml.c b/telepathy-logger/log-iter-xml.c
index 1684a74..df531e4 100644
--- a/telepathy-logger/log-iter-xml.c
+++ b/telepathy-logger/log-iter-xml.c
@@ -81,8 +81,12 @@ tpl_log_iter_xml_get_events (TplLogIter *iter,
priv->account, priv->target, priv->type_mask,
(GDate *) priv->next_date->data);
- priv->next_event = g_list_last (priv->events);
priv->next_date = g_list_previous (priv->next_date);
+
+ if (priv->events == NULL)
+ continue;
+
+ priv->next_event = g_list_last (priv->events);
}
event = TPL_EVENT (priv->next_event->data);
More information about the telepathy-commits
mailing list