Skip to content

Commit

Permalink
check bounds in readAtomData
Browse files Browse the repository at this point in the history
Fixes #78
  • Loading branch information
dhowden committed Nov 19, 2020
1 parent 6b18201 commit 4b595ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mp4.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ func (m metadataMP4) readAtomData(r io.ReadSeeker, name string, size uint32, pro
// "data" + size (4 bytes each)
b = b[8:]

if len(b) < 3 {
return fmt.Errorf("invalid encoding: expected at least %d bytes, for class, got %d", 3, len(b))
if len(b) < 4 {
return fmt.Errorf("invalid encoding: expected at least %d bytes, for class, got %d", 4, len(b))
}
class := getInt(b[1:4])
var ok bool
Expand Down

0 comments on commit 4b595ed

Please sign in to comment.