[FFmpeg-cvslog] pcx: properly pad the scanline

Anton Khirnov git at videolan.org
Sun Mar 19 18:52:24 EET 2017


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Aug 14 10:18:39 2016 +0200| [15ee419b7abaf17f8c662c145fe93d3dbf43282b] | committer: Anton Khirnov

pcx: properly pad the scanline

It is passed to the get_bits API, which requires buffers to be padded.

Fixes possible invalid reads.

CC: libav-stable at libav.org
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

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

 libavcodec/pcx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c
index aa69d51..77b2331 100644
--- a/libavcodec/pcx.c
+++ b/libavcodec/pcx.c
@@ -148,7 +148,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     ptr    = p->data[0];
     stride = p->linesize[0];
 
-    scanline = av_malloc(bytes_per_scanline);
+    scanline = av_malloc(bytes_per_scanline + AV_INPUT_BUFFER_PADDING_SIZE);
     if (!scanline)
         return AVERROR(ENOMEM);
 



More information about the ffmpeg-cvslog mailing list