Skip to content

Commit 737d356

Browse files
committed
mp4: fix panic on invalid encoding
Fixes #31
1 parent 3066d30 commit 737d356

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mp4.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ func readCustomAtom(r io.ReadSeeker, size uint32) (string, uint32, error) {
220220
if err != nil {
221221
return "", 0, err
222222
}
223+
224+
if len(b) < 4 {
225+
return "", 0, fmt.Errorf("expected at least %d bytes, got %d", 4, len(b))
226+
}
223227
subNames[subName] = string(b[4:])
224228

225229
case "data":

0 commit comments

Comments
 (0)