Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions codecs/vp8_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@
if payloadIndex >= payloadLen {
return nil, errShortPacket
}
if payload[payloadIndex]&0x80 > 0 { // M == 1, PID is 16bit
if payload[payloadIndex]&0x80 > 0 { // M == 1, PID is 16bit //nolint:gosec // bounds checked above

Check failure on line 166 in codecs/vp8_packet.go

View workflow job for this annotation

GitHub Actions / lint / Go

G602: slice index out of range (gosec)
if payloadIndex+1 >= payloadLen {
return nil, errShortPacket
}
p.PictureID = (uint16(payload[payloadIndex]&0x7F) << 8) | uint16(payload[payloadIndex+1])
p.PictureID = (uint16(payload[payloadIndex]&0x7F) << 8) | uint16(payload[payloadIndex+1]) //nolint:gosec // bounds checked above

Check failure on line 170 in codecs/vp8_packet.go

View workflow job for this annotation

GitHub Actions / lint / Go

The line is 131 characters long, which exceeds the maximum of 120 characters. (lll)
payloadIndex += 2
} else {
p.PictureID = uint16(payload[payloadIndex])
p.PictureID = uint16(payload[payloadIndex]) //nolint:gosec // bounds checked above
payloadIndex++
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion codecs/vp9_packet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func TestVP9Payloader_Payload(t *testing.T) {
r0 := int(rand.New(rand.NewSource(0)).Int31n(0x7FFF)) //nolint:gosec
var rands [][2]byte
for i := 0; i < 10; i++ {
rands = append(rands, [2]byte{byte(r0>>8) | 0x80, byte(r0 & 0xFF)})
rands = append(rands, [2]byte{byte(r0>>8) | 0x80, byte(r0 & 0xFF)}) //nolint:gosec // r0 is bounded to 0x7FFF
r0++
}

Expand Down
2 changes: 1 addition & 1 deletion packetizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestPacketizer(t *testing.T) {
if len(packets) != expectedLen {
var packetlengths strings.Builder
for i := range packets {
packetlengths.WriteString(fmt.Sprintf("Packet %d length %d\n", i, len(packets[i].Payload)))
fmt.Fprintf(&packetlengths, "Packet %d length %d\n", i, len(packets[i].Payload))
}
assert.Failf(
t, "Packetize failed", "Generated %d packets instead of %d\n%s",
Expand Down
8 changes: 4 additions & 4 deletions playoutdelayextension.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
return 0, io.ErrShortBuffer
}
buf[0] = byte(p.MinDelay >> 4)
buf[1] = byte(p.MinDelay<<4) | byte(p.MaxDelay>>8)
buf[2] = byte(p.MaxDelay)
buf[1] = byte(p.MinDelay<<4) | byte(p.MaxDelay>>8) //nolint:gosec // values validated above
buf[2] = byte(p.MaxDelay) //nolint:gosec // values validated above

Check failure on line 47 in playoutdelayextension.go

View workflow job for this annotation

GitHub Actions / lint / Go

File is not properly formatted (gci)

return playoutDelayExtensionSize, nil
}
Expand All @@ -57,8 +57,8 @@

return []byte{
byte(p.MinDelay >> 4),
byte(p.MinDelay<<4) | byte(p.MaxDelay>>8),
byte(p.MaxDelay),
byte(p.MinDelay<<4) | byte(p.MaxDelay>>8), //nolint:gosec // values validated above
byte(p.MaxDelay), //nolint:gosec // values validated above
}, nil
}

Expand Down
6 changes: 3 additions & 3 deletions vlaextension.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
offset := 0

// RID, NS, sl_bm fields
buf[offset] = byte(v.RTPStreamID<<6) | byte(v.RTPStreamCount-1)<<4 | ctx.commonSLBM
buf[offset] = byte(v.RTPStreamID<<6) | byte(v.RTPStreamCount-1)<<4 | ctx.commonSLBM //nolint:gosec // values are small

if ctx.commonSLBM == 0 {
offset++
Expand All @@ -182,7 +182,7 @@
temporalLayerIndex = 0
offset++
}
buf[offset] |= byte(len(v.ActiveSpatialLayer[idx].TargetBitrates)-1) << (2 * (3 - temporalLayerIndex))
buf[offset] |= byte(len(v.ActiveSpatialLayer[idx].TargetBitrates)-1) << (2 * (3 - temporalLayerIndex)) //nolint:gosec // values are small

Check failure on line 185 in vlaextension.go

View workflow job for this annotation

GitHub Actions / lint / Go

The line is 141 characters long, which exceeds the maximum of 120 characters. (lll)
temporalLayerIndex++
}
}
Expand All @@ -205,7 +205,7 @@
for _, sl := range v.ActiveSpatialLayer {
binary.BigEndian.PutUint16(buf[offset+0:], uint16(sl.Width-1)) //nolint:gosec
binary.BigEndian.PutUint16(buf[offset+2:], uint16(sl.Height-1)) //nolint:gosec
buf[offset+4] = byte(sl.Framerate)
buf[offset+4] = byte(sl.Framerate) //nolint:gosec // framerate fits in byte

Check failure on line 208 in vlaextension.go

View workflow job for this annotation

GitHub Actions / lint / Go

File is not properly formatted (gci)
offset += 5
}
}
Expand Down
Loading