From 1eda55510ae5d15ce3df9f496002508580899045 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 16 May 2015 22:51:16 +0200 Subject: [PATCH] lavc/qdrw: Fix overwrite when reading invalid Quickdraw images. --- libavcodec/qdrw.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c index 6c920aa460..0bcf5dca22 100644 --- a/libavcodec/qdrw.c +++ b/libavcodec/qdrw.c @@ -95,6 +95,8 @@ static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc, pos -= offset; pos++; } + if (pos >= offset) + return AVERROR_INVALIDDATA; } left -= 2; } else { /* copy */ @@ -105,6 +107,8 @@ static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc, pos -= offset; pos++; } + if (pos >= offset) + return AVERROR_INVALIDDATA; } left -= 2 + code; }