mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-09 10:38:10 -06:00
Allocate a buffer and copy compressed chunk rather
Otherwise the compression buffer will get stomped on before the results channel is consumed
This commit is contained in:
@@ -385,7 +385,6 @@ func writeDataToArchive(
|
||||
groupCount++
|
||||
|
||||
cmpBuff = gozstd.Compress(cmpBuff[:0], cg.dict)
|
||||
|
||||
dictId, err := arcW.writeByteSpan(cmpBuff)
|
||||
if err != nil {
|
||||
return 0, 0, 0, err
|
||||
@@ -473,7 +472,11 @@ func compressChunksInParallel(
|
||||
return
|
||||
}
|
||||
cmpBuff = gozstd.CompressDict(cmpBuff[:0], c.Data(), defaultDict)
|
||||
resultCh <- compressedChunk{h: h, data: cmpBuff}
|
||||
|
||||
// Make a private copy of the compressed data
|
||||
privateCopy := make([]byte, len(cmpBuff))
|
||||
copy(privateCopy, cmpBuff)
|
||||
resultCh <- compressedChunk{h: h, data: privateCopy}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user