Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion walk/cached.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package walk

import (
"bytes"
"context"
"errors"
"fmt"
Expand Down Expand Up @@ -102,7 +103,9 @@ func (c *CachedReader) Read(ctx context.Context, files []*File) (n int, err erro
for i := range n {
file := files[i]

file.CachedFormatSignature = bucket.Get([]byte(file.RelPath))
// Avoid use-after-free as bucket.Get returns a slice that is only valid for
// the lifetime of this transaction.
file.CachedFormatSignature = bytes.Clone(bucket.Get([]byte(file.RelPath)))

// set a release function which inserts this file into the update channel
file.AddReleaseFunc(func(ctx context.Context) error {
Expand Down