Skip to content

Commit

Permalink
Avoid integer overflow in large range requests (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaul authored Jun 11, 2021
1 parent ff31daa commit a755b8f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fakestorage/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"io"
"math"
"net/http"
"sort"
"strconv"
Expand Down Expand Up @@ -544,7 +545,7 @@ func (s *Server) handleRange(obj Object, r *http.Request) (start, end int, conte
var err error
if end, err = strconv.Atoi(rangeParts[1]); err != nil {
end = len(obj.Content)
} else {
} else if end != math.MaxInt64 {
end++
}
if end > len(obj.Content) {
Expand Down

0 comments on commit a755b8f

Please sign in to comment.