[FFmpeg-cvslog] jvdec: stop reading partial palette

Paul B Mahol git at videolan.org
Tue Jul 3 16:20:52 CEST 2012


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Jul  3 11:16:56 2012 +0000| [1c638cfc25fdba1369ebd16aa7c8393a73ef9801] | committer: Paul B Mahol

jvdec: stop reading partial palette

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavcodec/jvdec.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index 728b749..acf1885 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;



More information about the ffmpeg-cvslog mailing list