[FFmpeg-devel] [PATCH 1/4] jvdec: stop reading partial palette

Paul B Mahol onemda at gmail.com
Tue Jul 3 14:00:31 CEST 2012


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/jvdec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index 728b749..27298e3 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 + AVPALETTE_COUNT * 3 <= buf_end) {
+        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;
-- 
1.7.7



More information about the ffmpeg-devel mailing list