aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/jvdec.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-07-03 11:16:56 +0000
committerPaul B Mahol <onemda@gmail.com>2012-07-03 13:06:23 +0000
commit1c638cfc25fdba1369ebd16aa7c8393a73ef9801 (patch)
treedfe35b258f39fafa1b1abf617a82d3f95c494c28 /libavcodec/jvdec.c
parentc673a90b0d7c472db36caea0f27dbd2d5f3095ad (diff)
downloadffmpeg-1c638cfc25fdba1369ebd16aa7c8393a73ef9801.tar.gz
jvdec: stop reading partial palette
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/jvdec.c')
-rw-r--r--libavcodec/jvdec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index 728b749896..acf1885611 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -174,8 +174,8 @@ static int decode_frame(AVCodecContext *avctx,
}
}
- if (buf < buf_end) {
- for (i = 0; i < AVPALETTE_COUNT && buf + 3 <= buf_end; i++) {
+ if (buf_end - buf >= AVPALETTE_COUNT * 3) {
+ for (i = 0; i < AVPALETTE_COUNT; i++) {
uint32_t pal = AV_RB24(buf);
s->palette[i] = 0xFF << 24 | pal << 2 | ((pal >> 4) & 0x30303);
buf += 3;