1 From 573d5fdedae72bf59d8c0b0766fdee171063d36f Mon Sep 17 00:00:00 2001
2 From: Michael Niedermayer <michaelni@gmx.at>
3 Date: Sun, 16 Feb 2014 23:08:52 +0100
4 Subject: [PATCH] avcodec/msrle: use av_image_get_linesize() to calculate the
7 Upstream-Status: Backport
9 Commit 573d5fdedae72bf59d8c0b0766fdee171063d36f release/0.9
11 Fixes out of array access
12 Fixes: 14a74a0a2dc67ede543f0e35d834fbbe-asan_heap-oob_49572c_556_cov_215466444_44_001_engine_room.mov
13 Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
14 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
15 (cherry picked from commit c919e1ca2ecfc47d796382973ba0e48b8f6f92a2)
20 (cherry picked from commit bc1c8ec5e65098fd2ccd8456f667151dfc9cda42)
22 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
24 libavcodec/msrle.c | 3 ++-
25 1 files changed, 2 insertions(+), 1 deletions(-)
27 diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
28 index 30159bb..c39ae7b 100644
29 --- a/gst-libs/ext/libav/libavcodec/msrle.c
30 +++ b/gst-libs/ext/libav/libavcodec/msrle.c
35 +#include "libavutil/imgutils.h"
37 typedef struct MsrleContext {
38 AVCodecContext *avctx;
39 @@ -107,7 +108,7 @@ static int msrle_decode_frame(AVCodecContext *avctx,
41 /* FIXME how to correctly detect RLE ??? */
42 if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
43 - int linesize = avctx->width * avctx->bits_per_coded_sample / 8;
44 + int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0);
45 uint8_t *ptr = s->frame.data[0];
46 uint8_t *buf = avpkt->data + (avctx->height-1)*istride;