check bounds in readAtomData

Fixes #78
This commit is contained in:
David Howden 2020-11-20 06:28:13 +11:00
parent 6b18201aa5
commit 4b595ed4fa

4
mp4.go
View File

@ -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