Browse Source

ensure correct conversion

pull/7481/head
chrislu 3 weeks ago
parent
commit
afc68ff880
  1. 4
      weed/s3api/s3api_object_handlers.go

4
weed/s3api/s3api_object_handlers.go

@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"io"
"math"
"mime"
"net/http"
"net/url"
@ -692,6 +693,9 @@ func (s3a *S3ApiServer) streamFromVolumeServers(w http.ResponseWriter, r *http.R
if len(entry.Content) > 0 && totalSize == int64(len(entry.Content)) {
if isRangeRequest {
// Safely convert int64 to int for slice indexing
if offset < 0 || offset > int64(math.MaxInt) || size < 0 || size > int64(math.MaxInt) {
return fmt.Errorf("range too large for platform: offset=%d, size=%d", offset, size)
}
start := int(offset)
end := start + int(size)
// Bounds check (should already be validated, but double-check)

Loading…
Cancel
Save