diff mbox series

[FFmpeg-devel,2/3] avformat/concatdec: Check file

Message ID 20240430004854.199741-2-michael@niedermayer.cc
State Accepted
Commit a5d1497f33afa17b6a3578b66638e69bf8a558de
Headers show
Series [FFmpeg-devel,1/3] avformat/kvag: Check sample_rate | expand

Commit Message

Michael Niedermayer April 30, 2024, 12:48 a.m. UTC
Fixes: null pointer dereference
Fixes: -stream_loop 1 -ss 00:00:05 -i zgclab/ffmpeg_crash/poc2 -codec:v copy -codec:a aac -y output.mp4

Found-by: Wang Dawei and Zhou Geng, from Zhongguancun Laboratory
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/concatdec.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Michael Niedermayer May 9, 2024, 1:03 a.m. UTC | #1
On Tue, Apr 30, 2024 at 02:48:53AM +0200, Michael Niedermayer wrote:
> Fixes: null pointer dereference
> Fixes: -stream_loop 1 -ss 00:00:05 -i zgclab/ffmpeg_crash/poc2 -codec:v copy -codec:a aac -y output.mp4
> 
> Found-by: Wang Dawei and Zhou Geng, from Zhongguancun Laboratory
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/concatdec.c | 5 +++++
>  1 file changed, 5 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 493659649cf..fe65d0c7688 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -639,6 +639,11 @@  static int concat_parse_script(AVFormatContext *avf)
         }
     }
 
+    if (!file) {
+        ret = AVERROR_INVALIDDATA;
+        goto fail;
+    }
+
     if (file->inpoint != AV_NOPTS_VALUE && file->outpoint != AV_NOPTS_VALUE) {
         if (file->inpoint  > file->outpoint ||
             file->outpoint - (uint64_t)file->inpoint > INT64_MAX)