[libdazzle] fuzzy: be a bit more defensive
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] fuzzy: be a bit more defensive
- Date: Sat, 16 Jun 2018 10:39:40 +0000 (UTC)
commit 5093dad1b1f8c154637c0fae4f1659dfb4c1fe87
Author: Christian Hergert <chergert redhat com>
Date: Sat Jun 16 03:39:21 2018 -0700
fuzzy: be a bit more defensive
src/search/dzl-fuzzy-index-cursor.c | 2 +-
src/search/dzl-fuzzy-index.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/search/dzl-fuzzy-index-cursor.c b/src/search/dzl-fuzzy-index-cursor.c
index 9063808..cdbc926 100644
--- a/src/search/dzl-fuzzy-index-cursor.c
+++ b/src/search/dzl-fuzzy-index-cursor.c
@@ -459,7 +459,7 @@ dzl_fuzzy_index_cursor_worker (GTask *task,
guint score = dzl_int_pair_first (pair);
guint last_offset = dzl_int_pair_second (pair);
gpointer other_score;
- DzlFuzzyMatch match;
+ DzlFuzzyMatch match = {0};
guint lookaside_id = GPOINTER_TO_UINT (key);
if G_UNLIKELY (!_dzl_fuzzy_index_resolve (self->index,
diff --git a/src/search/dzl-fuzzy-index.c b/src/search/dzl-fuzzy-index.c
index 1b035f9..9ee8139 100644
--- a/src/search/dzl-fuzzy-index.c
+++ b/src/search/dzl-fuzzy-index.c
@@ -479,6 +479,9 @@ _dzl_fuzzy_index_resolve (DzlFuzzyIndex *self,
g_assert (out_score != NULL);
g_assert (priority != NULL);
+ if (self->keys == NULL || self->lookaside_raw == NULL)
+ return FALSE;
+
/* Mask off the key priority */
lookaside_id &= 0x00FFFFFF;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]