Skip to content

Commit

Permalink
Merge pull request #331 from jaesung9507/panic
Browse files Browse the repository at this point in the history
[fix] rtmp: panic in SetChunkSize msg while the length is too short
  • Loading branch information
q191201771 authored Nov 14, 2023
2 parents 181e594 + 5f32142 commit 92252c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/rtmp/chunk_composer.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ func (c *ChunkComposer) RunLoop(reader io.Reader, cb OnCompleteMessage) error {
if stream.msg.Len() == stream.header.MsgLen {
// 对端设置了chunk size
if stream.header.MsgTypeId == base.RtmpTypeIdSetChunkSize {
val := bele.BeUint32(stream.msg.buff.Bytes())
c.SetPeerChunkSize(val)
if buf := stream.msg.buff.Bytes(); len(buf) >= 4 {
val := bele.BeUint32(buf)
c.SetPeerChunkSize(val)
}
}

stream.header.Csid = csid
Expand Down

0 comments on commit 92252c8

Please sign in to comment.