Skip to content

Commit

Permalink
Fix panic on h264.EmitNalus #1076
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed May 5, 2024
1 parent 4933c14 commit 4c3de3b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/h264/payloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ func EmitNalus(nals []byte, isAVC bool, emit func([]byte)) {
}
} else {
for {
n := uint32(len(nals))
if n < 4 {
break
}
end := 4 + binary.BigEndian.Uint32(nals)
emit(nals[4:end])
if int(end) >= len(nals) {
if n < end {
break
}
emit(nals[4:end])
nals = nals[end:]
}
}
Expand Down

0 comments on commit 4c3de3b

Please sign in to comment.