From 0df4b9e7f77c31d58b9486122f86625092ac22ff Mon Sep 17 00:00:00 2001 From: "Vuppuluri, Nirmal" Date: Mon, 18 Dec 2023 12:10:51 -0500 Subject: [PATCH] Fix: InBoundMatching does not properly accept passed-in buffer. InBoundMatching() checks whether the length of the passed-in buffer is > 0 and if so, uses it. However, this does not properly handle the case where the passed-in buffer is allocated, i.e. cap(buf) > 0 and len(buf) == 0. --- quadtree/quadtree.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quadtree/quadtree.go b/quadtree/quadtree.go index 847a0af..e83a287 100644 --- a/quadtree/quadtree.go +++ b/quadtree/quadtree.go @@ -299,7 +299,7 @@ func (q *Quadtree) InBoundMatching(buf []orb.Pointer, b orb.Bound, f FilterFunc) } var p []orb.Pointer - if len(buf) > 0 { + if buf != nil { p = buf[:0] } v := &inBoundVisitor{