Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-17 02:08:52 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-03-21 07:23:59 +0400
commit573d5fdedae72bf59d8c0b0766fdee171063d36f (patch)
tree80656d9abe66af72641345bb0a05de30c2d44c14
parentd234e1d333c95d2f883830e8deeac04cd1c15673 (diff)
avcodec/msrle: use av_image_get_linesize() to calculate the linesize
Fixes out of array access Fixes: 14a74a0a2dc67ede543f0e35d834fbbe-asan_heap-oob_49572c_556_cov_215466444_44_001_engine_room.mov Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit c919e1ca2ecfc47d796382973ba0e48b8f6f92a2) Conflicts: libavcodec/msrle.c (cherry picked from commit bc1c8ec5e65098fd2ccd8456f667151dfc9cda42) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/msrle.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
index 30159bb006..c39ae7bd44 100644
--- a/libavcodec/msrle.c
+++ b/libavcodec/msrle.c
@@ -35,6 +35,7 @@
#include "avcodec.h"
#include "dsputil.h"
#include "msrledec.h"
+#include "libavutil/imgutils.h"
typedef struct MsrleContext {
AVCodecContext *avctx;
@@ -107,7 +108,7 @@ static int msrle_decode_frame(AVCodecContext *avctx,
/* FIXME how to correctly detect RLE ??? */
if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
- int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8;
+ int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0);
uint8_t *ptr = s->frame.data[0];
uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
int i, j;