Commit 6068e765 authored by Amos Wenger's avatar Amos Wenger

ByteView: return -1 on out of range reads, closes https://github.com/itchio/itch/issues/2113

parent 559605be
Pipeline #14619 passed with stage
in 1 minute and 52 seconds
......@@ -16,6 +16,11 @@ type ByteView struct {
// Get returns the byte at index i, or -1 if we
// failed to read
func (bv *ByteView) Get(i int64) int {
if i < 0 {
// yeah that's out of range, don't bother reading
return 1
}
if bv.buf == nil {
bv.buf = make([]byte, maxBufLen)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment