From 4b595ed4fac79f467594aa92f8953f90f817116e Mon Sep 17 00:00:00 2001 From: David Howden Date: Fri, 20 Nov 2020 06:28:13 +1100 Subject: [PATCH] check bounds in readAtomData Fixes #78 --- mp4.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mp4.go b/mp4.go index bc0286b..6523397 100644 --- a/mp4.go +++ b/mp4.go @@ -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