diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-11-15 19:06:23 +0100 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2014-01-05 17:12:31 -0500 |
commit | 51ff11647f8dea26abfc63a533f7144b0502197d (patch) | |
tree | 6bb49237002794e5fb21e22d7e57d056debd4da4 /libavcodec | |
parent | 35f9a0896ee6858114831a5a8e951872e4473a75 (diff) | |
download | ffmpeg-51ff11647f8dea26abfc63a533f7144b0502197d.tar.gz |
pcx: round up in bits->bytes conversion in a buffer size check
Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 430d12196432ded13f011a3bf7690f03c9b2e5d6)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/pcx.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c index 223429d35e..4bc9adc744 100644 --- a/libavcodec/pcx.c +++ b/libavcodec/pcx.c @@ -120,7 +120,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, nplanes = buf[65]; bytes_per_scanline = nplanes * bytes_per_line; - if (bytes_per_scanline < w * bits_per_pixel * nplanes / 8 || + if (bytes_per_scanline < (w * bits_per_pixel * nplanes + 7) / 8 || (!compressed && bytes_per_scanline > buf_size / h)) { av_log(avctx, AV_LOG_ERROR, "PCX data is corrupted\n"); return -1; |