diff mbox series

[FFmpeg-devel,7/8] avformat/mov: Disallow a single unspecified size tag on probing

Message ID 20210206172301.11769-7-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/8] avformat/mov: factor size out of probe code | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer Feb. 6, 2021, 5:23 p.m. UTC
This avoids accepting bizare constructs like a mdat at position 0 and size 0

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Feb. 6, 2021, 10:11 p.m. UTC | #1
LGTM, with either offset -1 or 0 when first initialized.
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5440078459..2df6762ec9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7117,7 +7117,7 @@  static int mov_probe(const AVProbeData *p)
         if (size == 1 && offset + 16 > (unsigned int)p->buf_size) {
             size = AV_RB64(p->buf+offset + 8);
             minsize = 16;
-        } else if (size == 0) {
+        } else if (size == 0 && offset) {
             size = p->buf_size - offset;
         }
         if (size < minsize) {