diff mbox series

[FFmpeg-devel,3/4] avformat/avienc: Check video dimensions

Message ID 20220703141811.29914-3-michael@niedermayer.cc
State Accepted
Commit ba0c3d1db420dfaeaec44a8bbd40ec5593dccb04
Headers show
Series [FFmpeg-devel,1/4] avcodec/ffv1dec_template: Fix indention | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer July 3, 2022, 2:18 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/avienc.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 2264241d57..14115b3e2b 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -426,6 +426,10 @@  static int avi_write_header(AVFormatContext *s)
         avio_wl32(pb, -1); /* quality */
         avio_wl32(pb, au_ssize); /* sample size */
         avio_wl32(pb, 0);
+        if (par->width > 65535 || par->height > 65535) {
+            av_log(s, AV_LOG_ERROR, "%dx%d dimensions are too big\n", par->width, par->height);
+            return AVERROR(EINVAL);
+        }
         avio_wl16(pb, par->width);
         avio_wl16(pb, par->height);
         ff_end_tag(pb, strh);