From 6fe9ba391bba3eecfcc74aa514a54c02e03367d2 Mon Sep 17 00:00:00 2001 From: Justin Buchanan Date: Tue, 9 May 2023 15:57:07 -0700 Subject: [PATCH] fix(xrefs_filter): properly merge page lists that represent allPages (#5624) Previously, uint32max, which represents the set of all pages, was being merged into the list of page indices and later used as an array index, which was out of bounds. --- kythe/go/serving/xrefs/xrefs_filter.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kythe/go/serving/xrefs/xrefs_filter.go b/kythe/go/serving/xrefs/xrefs_filter.go index 2960fbaeb4..f9241a3b3c 100644 --- a/kythe/go/serving/xrefs/xrefs_filter.go +++ b/kythe/go/serving/xrefs/xrefs_filter.go @@ -261,6 +261,9 @@ func postingAnd(idx postings, list []uint32, trigram uint32) []uint32 { } func mergeOr(l1, l2 []uint32) []uint32 { + if isAllPages(l1) || isAllPages(l2) { + return allPages + } var l []uint32 var i, j int for i < len(l1) || j < len(l2) {