Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
---
 libavcodec/sunrast.c | 6 +++---
 1 file 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");
 
-- 
2.23.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to