Skip to content

Commit

Permalink
mp4: fix panic on invalid encoding
Browse files Browse the repository at this point in the history
Fixes #31
  • Loading branch information
dhowden committed Feb 7, 2018
1 parent 3066d30 commit 737d356
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mp4.go
Expand Up @@ -220,6 +220,10 @@ func readCustomAtom(r io.ReadSeeker, size uint32) (string, uint32, error) {
if err != nil {
return "", 0, err
}

if len(b) < 4 {
return "", 0, fmt.Errorf("expected at least %d bytes, got %d", 4, len(b))
}
subNames[subName] = string(b[4:])

case "data":
Expand Down

0 comments on commit 737d356

Please sign in to comment.