reject invalid offset/length in map storage
import (
"context"
+ "errors"
"sort"
"strings"
"sync"
@@ -28,6 +29,10 @@ func (s *mapStorage) GetBlock(ctx context.Context, id string, offset, length int
return data, nil
}
+ if int(offset) > len(data) || offset < 0 {
+ return nil, errors.New("invalid offset")
+ }
+
data = data[offset:]
if int(length) > len(data) {
return data, nil
