summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2020-11-23 20:22:07 +0000
committerMichael Catanzaro <mcatanzaro@gnome.org>2020-11-30 15:22:35 +0000
commit5ceac60b4d9dd685ed2823dde1ff17b45fa3f265 (patch)
treea3b8255b04f17e0a10f0d0dfa2c375ccf903d66a
parentb211d985079e7ffeae5c7d66cc7cd1034fddda53 (diff)
downloadepiphany-5ceac60b4d9dd685ed2823dde1ff17b45fa3f265.tar.gz
gsb-service: don't crash when GSB database is broken
Currently there are four places where we assert the GSB database is not broken. But some of these asserts are wrong. Two are clearly safe, and one is clearly not (since it was actually hit). I think the other is also not safe. https://bugzilla.redhat.com/show_bug.cgi?id=1900656 (cherry picked from commit 3829d5687af829ef2e6ade8c77061ba052a2918a)
-rw-r--r--lib/safe-browsing/ephy-gsb-service.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/safe-browsing/ephy-gsb-service.c b/lib/safe-browsing/ephy-gsb-service.c
index 98d23d3fa..1070c2870 100644
--- a/lib/safe-browsing/ephy-gsb-service.c
+++ b/lib/safe-browsing/ephy-gsb-service.c
@@ -141,7 +141,12 @@ ephy_gsb_service_schedule_update (EphyGSBService *self)
gint64 interval;
g_assert (EPHY_IS_GSB_SERVICE (self));
- g_assert (ephy_gsb_storage_is_operable (self->storage));
+
+ if (!ephy_gsb_storage_is_operable (self->storage)) {
+ self->source_id = 0;
+ LOG ("Local GSB database is broken, cannot schedule update");
+ return;
+ }
/* This function should only be called when self->next_list_updates_time is
* greater than CURRENT_TIME. However, asserting (self->next_list_updates_time
@@ -178,7 +183,11 @@ ephy_gsb_service_update_thread (GTask *task,
char *body;
g_assert (EPHY_IS_GSB_SERVICE (self));
- g_assert (ephy_gsb_storage_is_operable (self->storage));
+
+ if (!ephy_gsb_storage_is_operable (self->storage)) {
+ LOG ("Local GSB database is broken, cannot update it");
+ goto out;
+ }
/* Set up a default next update time in case of failure or non-existent
* minimum wait duration.