Skip to content

Commit

Permalink
fix: supress spurious gosec warning on safe operation
Browse files Browse the repository at this point in the history
  • Loading branch information
JimLarson committed Oct 7, 2022
1 parent b8a6b78 commit 08731fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tx/textual/valuerenderer/duration.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ func (dr durationValueRenderer) Parse(_ context.Context, r io.Reader) (protorefl

dur := &dpb.Duration{}
dur.Seconds = days*day_sec + hours*hour_sec + minutes*min_sec + seconds
dur.Nanos = int32(nanos & (2<<32 - 1))
// #nosec G701
// Since there are 9 digits or fewer, this conversion is safe.
dur.Nanos = int32(nanos)

if negative {
dur.Seconds *= -1
Expand Down

0 comments on commit 08731fe

Please sign in to comment.