mirror of
https://github.com/livekit/livekit.git
synced 2026-04-01 21:45:46 +00:00
Fix out-of-range access. (#2082)
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.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user