[FFmpeg-devel] qtrle_decode_init: check frame dimensions

Submitted by Xiao Yang on June 12, 2018, 12:24 a.m.

Details

Message ID SIXPR01MB05608062442C9B7D3C8DA86CAD7F0@SIXPR01MB0560.apcprd01.prod.exchangelabs.com
State New
Headers show

Commit Message

Xiao Yang June 12, 2018, 12:24 a.m.
---
 libavcodec/qtrle.c |    7 +++++++
 1 file changed, 7 insertions(+)

Comments

Michael Niedermayer June 13, 2018, 2:28 p.m.
On Tue, Jun 12, 2018 at 12:24:15AM +0000, Xiao Yang wrote:
> ---
>  libavcodec/qtrle.c |    7 +++++++
>  1 file changed, 7 insertions(+)

Please provide a reproducable testcase that shows the problem this fixes

thanks

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
index 670690d..1cceeff 100644
--- a/libavcodec/qtrle.c
+++ b/libavcodec/qtrle.c
@@ -415,6 +415,13 @@  static av_cold int qtrle_decode_init(AVCodecContext *avctx)
         return AVERROR_INVALIDDATA;
     }
 
+    if (!avctx->width || !avctx->height ||
+        (avctx->width & 1) || (avctx->height & 1)) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid video dimensions: %dx%d\n",
+               avctx->width, avctx->height);
+        return AVERROR(EINVAL);
+    }
+
     s->frame = av_frame_alloc();
     if (!s->frame)
         return AVERROR(ENOMEM);