Skip to content

Commit

Permalink
Fix zed.MapperLookupCache bug (#4877)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nwt authored Nov 10, 2023
1 parent cd36eaa commit 4241f5f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type MapperLookupCache struct {
}

func (m *MapperLookupCache) Reset(mapper *Mapper) {
clear(m.cache)
m.cache = m.cache[:0]
m.mapper = mapper
}
Expand Down

0 comments on commit 4241f5f

Please sign in to comment.