From 4241f5f64258a2fdf046d65729efda5a96795bca Mon Sep 17 00:00:00 2001 From: Noah Treuhaft Date: Fri, 10 Nov 2023 17:40:18 -0500 Subject: [PATCH] Fix zed.MapperLookupCache bug (#4877) The recent switch in MapperLookupCache.Lookup to slices.Grow in #4864 introduces a bug because Reset truncates the cache without zeroing it, allowing slices.Grow to expose old entries. This wasn't a problem previously because the method used to grow the cache zeroed old entries before reusing their storage. --- mapper.go | 1 + 1 file changed, 1 insertion(+) diff --git a/mapper.go b/mapper.go index 5348ab3da5..b1c0d3ba53 100644 --- a/mapper.go +++ b/mapper.go @@ -72,6 +72,7 @@ type MapperLookupCache struct { } func (m *MapperLookupCache) Reset(mapper *Mapper) { + clear(m.cache) m.cache = m.cache[:0] m.mapper = mapper }