Skip to content

Commit

Permalink
objectpacker: Assure gosec that in.Len() to uint64 cannot overflow
Browse files Browse the repository at this point in the history
> objectpacker/objectpacker.go:91:55: G115: integer overflow conversion int -> uint64 (gosec)
>                 if err := binary.Write(out, binary.BigEndian, uint64(l)); err != nil {
  • Loading branch information
oxzi committed Oct 4, 2024
1 parent afba056 commit ef4abc3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions objectpacker/objectpacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func packValue(in reflect.Value, out io.Writer) error {
}

l := in.Len()
// #nosec G115 -- in.Len() is a non-negative number, thus cannot overflow for conversion to uint64
if err := binary.Write(out, binary.BigEndian, uint64(l)); err != nil {
return err
}
Expand Down Expand Up @@ -118,6 +119,7 @@ func packValue(in reflect.Value, out io.Writer) error {
}

l := in.Len()
// #nosec G115 -- in.Len() is a non-negative number, thus cannot overflow for conversion to uint64
if err := binary.Write(out, binary.BigEndian, uint64(l)); err != nil {
return err
}
Expand Down

0 comments on commit ef4abc3

Please sign in to comment.