[FFmpeg-cvslog] avcodec/rawdec: Check side data size before use

Michael Niedermayer git at videolan.org
Sat Nov 26 16:47:55 EET 2016


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Sun Oct 30 15:12:12 2016 +0100| [744f78ce0dc5d0e233828478b9f2cf0536b865df] | committer: Michael Niedermayer

avcodec/rawdec: Check side data size before use

Fixes out of array read

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 5f0bc0215a0f7099a2bcba5dced2e045e70fee61)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=744f78ce0dc5d0e233828478b9f2cf0536b865df
---

 libavcodec/rawdec.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index af764ab..3d46533 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -271,8 +271,13 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
     }
 
     if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
+        int pal_size;
         const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE,
-                                                     NULL);
+                                                     &pal_size);
+        if (pal_size != AVPALETTE_SIZE) {
+            av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", pal_size);
+            pal = NULL;
+        }
 
         if (pal) {
             av_buffer_unref(&context->palette);



More information about the ffmpeg-cvslog mailing list