diff mbox series

[FFmpeg-devel] avformat/mov: Disallow empty sidx

Message ID 20220302140124.12313-1-michael@niedermayer.cc
State Accepted
Commit 4419433d77278cb742944c4514be5f72a04103c0
Headers show
Series [FFmpeg-devel] avformat/mov: Disallow empty sidx | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Michael Niedermayer March 2, 2022, 2:01 p.m. UTC
It appears this is not allowed "Each Segment Index box documents how a (sub)segment is divided into one or more subsegments
(which may themselves be further subdivided using Segment Index boxes)."
Fixes: Null pointer dereference
Fixes: Ticket9517

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

Comments

Paul B Mahol March 2, 2022, 2:10 p.m. UTC | #1
lgtm
Michael Niedermayer March 2, 2022, 4:51 p.m. UTC | #2
On Wed, Mar 02, 2022 at 03:10:02PM +0100, Paul B Mahol wrote:
> lgtm

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5e26267810..68b6d7f075 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5118,6 +5118,8 @@  static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     avio_rb16(pb); // reserved
 
     item_count = avio_rb16(pb);
+    if (item_count == 0)
+        return AVERROR_INVALIDDATA;
 
     for (i = 0; i < item_count; i++) {
         int index;