From d6927cf1fee50214194157cbabad382c149d2c8f Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 12 Jul 2019 09:05:42 -0400 Subject: [PATCH] Ensure all members are initialized before loading selfie Theoretically, if a selfie is loaded from corrupted storage resulting in a thrown exception from the constructor, this would cause an improperly initialized HostnameBasedDB instance and overall potentially a broken uBO. Related feedback: - https://bugzilla.mozilla.org/show_bug.cgi?id=1543880#c7 --- src/js/static-ext-filtering.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/static-ext-filtering.js b/src/js/static-ext-filtering.js index 273c4f9a8..91aca2fef 100644 --- a/src/js/static-ext-filtering.js +++ b/src/js/static-ext-filtering.js @@ -516,14 +516,14 @@ this.nBits = nBits; this.timer = undefined; this.strToIdMap = new Map(); - if ( selfie !== undefined ) { - this.fromSelfie(selfie); - return; - } this.hostnameToSlotIdMap = new Map(); this.hostnameSlots = []; this.strSlots = []; this.size = 0; + if ( selfie !== undefined ) { + this.fromSelfie(selfie); + return; + } } store(hn, bits, s) {