mirror of https://github.com/jetkvm/kvm.git
Fix: increase Opus buffer size to 1500 bytes and add bounds check
This commit is contained in:
parent
1e22e007ea
commit
9371868b14
|
|
@ -21,7 +21,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ipcMaxFrameSize = 1024
|
ipcMaxFrameSize = 1500
|
||||||
)
|
)
|
||||||
|
|
||||||
type CgoSource struct {
|
type CgoSource struct {
|
||||||
|
|
@ -184,6 +184,10 @@ func (c *CgoSource) ReadMessage() (uint8, []byte, error) {
|
||||||
return 0, nil, nil
|
return 0, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if int(opusSize) > len(c.opusBuf) {
|
||||||
|
return 0, nil, fmt.Errorf("opus packet too large: %d > %d", opusSize, len(c.opusBuf))
|
||||||
|
}
|
||||||
|
|
||||||
return ipcMsgTypeOpus, c.opusBuf[:opusSize], nil
|
return ipcMsgTypeOpus, c.opusBuf[:opusSize], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue