Skip to content

Commit 03c136c

Browse files
authored
zstd: Disable extended memory copies (amd64) (#644)
Using longer memory copies leads to rare, random crashes with fuzz testing. It is therefore disabled for now.
1 parent b017051 commit 03c136c

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

zstd/seqdec_amd64.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,22 @@ func (s *sequenceDecs) decodeSyncSimple(hist []byte) (bool, error) {
5555
if s.maxSyncLen == 0 && cap(s.out)-len(s.out) < maxCompressedBlockSize {
5656
return false, nil
5757
}
58-
useSafe := false
59-
if s.maxSyncLen == 0 && cap(s.out)-len(s.out) < maxCompressedBlockSizeAlloc {
60-
useSafe = true
61-
}
62-
if s.maxSyncLen > 0 && cap(s.out)-len(s.out)-compressedBlockOverAlloc < int(s.maxSyncLen) {
63-
useSafe = true
64-
}
65-
if cap(s.literals) < len(s.literals)+compressedBlockOverAlloc {
66-
useSafe = true
67-
}
58+
59+
// FIXME: Using unsafe memory copies leads to rare, random crashes
60+
// with fuzz testing. It is therefore disabled for now.
61+
const useSafe = true
62+
/*
63+
useSafe := false
64+
if s.maxSyncLen == 0 && cap(s.out)-len(s.out) < maxCompressedBlockSizeAlloc {
65+
useSafe = true
66+
}
67+
if s.maxSyncLen > 0 && cap(s.out)-len(s.out)-compressedBlockOverAlloc < int(s.maxSyncLen) {
68+
useSafe = true
69+
}
70+
if cap(s.literals) < len(s.literals)+compressedBlockOverAlloc {
71+
useSafe = true
72+
}
73+
*/
6874

6975
br := s.br
7076

0 commit comments

Comments
 (0)