aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-10 16:52:04 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-10 16:52:38 +0100
commit6462268e74fa2c935c2936904cc1da9f499c04f3 (patch)
tree591a46a922c4015e0d2f86740683b7050d62ec9c /libavcodec
parent034a125c8c5178a5dd4a1ee8eb2168e15b0e94d7 (diff)
downloadffmpeg-6462268e74fa2c935c2936904cc1da9f499c04f3.tar.gz
pcx: fix rounding in bytes_per_scanline check
Fixes out of array reads Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/pcx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c
index d60e5020c2..6163c6e407 100644
--- a/libavcodec/pcx.c
+++ b/libavcodec/pcx.c
@@ -119,7 +119,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
bytes_per_line = bytestream2_get_le16u(&gb);
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) {
av_log(avctx, AV_LOG_ERROR, "PCX data is corrupted\n");
return AVERROR_INVALIDDATA;
}