Skip to content

Commit

Permalink
Fix out-of-range access. (#2082)
Browse files Browse the repository at this point in the history
Happens when converting quality in subscibed settings to layer.
Looks like it can happen only if the provided quality is OFF.
Don't know of any client that does that. Anyhow, prevent out-of-range
access which causea a panic.
  • Loading branch information
boks1971 committed Sep 18, 2023
1 parent 0b0431b commit ca2f8fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sfu/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ func (w *WebRTCReceiver) getBufferLocked(layer int32) *buffer.Buffer {
layer = 0
}

if int(layer) >= len(w.buffers) {
if layer < 0 || int(layer) >= len(w.buffers) {
return nil
}

Expand Down

0 comments on commit ca2f8fe

Please sign in to comment.