From f4abc0ffe43e45b0547bf646180afbef19245653 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Thu, 8 Aug 2019 12:10:40 +1000 Subject: [PATCH] Invalidate raczlib cache if re-using its memory --- lib/raczlib/reader.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/raczlib/reader.go b/lib/raczlib/reader.go index 3972cc30..328a6453 100644 --- a/lib/raczlib/reader.go +++ b/lib/raczlib/reader.go @@ -135,6 +135,8 @@ func (r *CodecReader) MakeReaderContext( buffer := []byte(nil) if n := dictSize + 4; int64(cap(r.cachedDictionary)) >= n { buffer = r.cachedDictionary[:n] + // Invalidate the cached dictionary, as we are re-using its memory. + r.cachedDictionaryCRange = rac.Range{} } else { buffer = make([]byte, n) }