From 3d90b03d7b0ec91db66c179dd82c3acdf487dc8e Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 22 Jun 2021 14:52:13 +0200 Subject: [PATCH] fix the limit There was no check on the limit and thus, if a user especified a very large number this line could causes a panic --- milli/src/search/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/milli/src/search/mod.rs b/milli/src/search/mod.rs index f692df173..71d200e0c 100644 --- a/milli/src/search/mod.rs +++ b/milli/src/search/mod.rs @@ -162,7 +162,7 @@ impl<'a> Search<'a> { let mut offset = self.offset; let mut initial_candidates = RoaringBitmap::new(); let mut excluded_candidates = RoaringBitmap::new(); - let mut documents_ids = Vec::with_capacity(self.limit); + let mut documents_ids = Vec::new(); while let Some(FinalResult { candidates, bucket_candidates, .. }) = criteria.next(&excluded_candidates)?