From 804fdc96f5dc1698d0ed3872de6c1d78feda2e59 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Fri, 6 May 2016 06:30:33 +0100 Subject: Fix binary-search OOB. This affects binary search in the history cache. The returned index can be one beyond the end of array, and so we get an error when we look it up blindly. So, we need to check. --- background_scripts/completion.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'background_scripts') diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 7cd47a00..66ad2e38 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -779,7 +779,7 @@ HistoryCache = # correct "lastVisitTime". That's crucial for ranking Vomnibar suggestions. onPageVisited: (newPage) -> i = HistoryCache.binarySearch(newPage, @history, @compareHistoryByUrl) - pageWasFound = (@history[i].url == newPage.url) + pageWasFound = (@history[i]?.url == newPage.url) if pageWasFound @history[i] = newPage else -- cgit v1.2.3