aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-21 18:10:25 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-11 20:18:47 +0100
commit3a45323c97e810dc27c2a4357e9348ebd629780f (patch)
tree7ceda4d93770ccb9be091ebf1ff679f8106a7f0a
parent878ba993166ef2b86acf46cfce8a7a8107ceb04b (diff)
downloadffmpeg-3a45323c97e810dc27c2a4357e9348ebd629780f.tar.gz
avcodec/sunrast: Check for availability of maplength before allocating image
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 711ad71aea7847883662bf95e01640d9745b313b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/sunrast.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
index baf184968f..98bc4ffa63 100644
--- a/libavcodec/sunrast.c
+++ b/libavcodec/sunrast.c
@@ -100,14 +100,14 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
if (ret < 0)
return ret;
+ if (buf_end - buf < maplength)
+ return AVERROR_INVALIDDATA;
+
if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
return ret;
p->pict_type = AV_PICTURE_TYPE_I;
- if (buf_end - buf < maplength)
- return AVERROR_INVALIDDATA;
-
if (depth > 8 && maplength) {
av_log(avctx, AV_LOG_WARNING, "useless colormap found or file is corrupted, trying to recover\n");