check bounds in readAtomData

Fixes #78
This commit is contained in:
David Howden
2020-11-20 06:28:17 +11:00
parent 6b18201aa5
commit 4b595ed4fa
+2 -2
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