[PATCH 03/11] lib: Handle empty date value
From: Austin Clements In the interest of robustness, avoid undefined behavior of sortable_unserialise if the date value is missing. This shouldn't happen now, but ghost messages will have blank date values. --- lib/message.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/message.cc b/lib/message.cc index bbfc250..38bc929 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -896,6 +896,9 @@ notmuch_message_get_date (notmuch_message_t *message) return 0; } +if (value.empty ()) + /* sortable_unserialise is undefined on empty string */ + return 0; return Xapian::sortable_unserialise (value); } -- 2.1.0
[PATCH 03/11] lib: Handle empty date value
From: Austin Clements In the interest of robustness, avoid undefined behavior of sortable_unserialise if the date value is missing. This shouldn't happen now, but ghost messages will have blank date values. --- lib/message.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/message.cc b/lib/message.cc index bbfc250..38bc929 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -896,6 +896,9 @@ notmuch_message_get_date (notmuch_message_t *message) return 0; } +if (value.empty ()) + /* sortable_unserialise is undefined on empty string */ + return 0; return Xapian::sortable_unserialise (value); } -- 2.1.0 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch