fix(verify): enlarge fuzz buffers so slice-based kernels can be fuzzed

directly
This commit is contained in:
2026-08-02 06:12:00 +02:00
parent a2acc9b5a3
commit 801fb963c9
+6 -1
View File
@@ -221,7 +221,10 @@ func genDualArgs(rng *rand.Rand, sig funcSig, argSize int) (gasmArgs, goArgs []b
} else {
declaredLen = n + 512
}
bufBytes := (declaredLen+16)*elemSize + 128
// Allocate a buffer comfortably larger than declaredLen*elemSize so
// that SIMD over-reads and functions that write slightly past len
// (e.g. decoders that trust len(src)) never touch unmapped memory.
bufBytes := declaredLen*elemSize + 8192
// Two independent buffers with identical random content.
buf1 := make([]byte, bufBytes)
buf2 := make([]byte, bufBytes)
@@ -230,6 +233,8 @@ func genDualArgs(rng *rand.Rand, sig funcSig, argSize int) (gasmArgs, goArgs []b
bufs = append(bufs, buf1, buf2)
putPtr(gasmArgs, off, unsafe.Pointer(&buf1[0]))
putPtr(goArgs, off, unsafe.Pointer(&buf2[0]))
// len and cap both equal declaredLen — the buffer is guaranteed
// to hold at least declaredLen elements plus safety margin.
putU64(gasmArgs, off+8, uint64(declaredLen))
putU64(gasmArgs, off+16, uint64(declaredLen))
putU64(goArgs, off+8, uint64(declaredLen))