"runtime"
"strconv"
"sync"
- "unsafe"
)
// The default bencode string length limit. This is a poor attempt to prevent excessive memory
d.buf.Grow(length)
b := d.buf.Bytes()[:length]
read(b)
- x, err := strconv.ParseBool(unsafe.String(unsafe.SliceData(b), len(b)))
+ x, err := strconv.ParseBool(bytesAsString(b))
if err != nil {
x = length != 0
}