[FFmpeg-cvslog] r26248 - trunk/libavcodec/tiff.c

cehoyos subversion
Thu Jan 6 23:12:55 CET 2011


Author: cehoyos
Date: Thu Jan  6 23:12:55 2011
New Revision: 26248

Log:
Fix a crash when decoding tiff by moving check
for invalid header up before reading data.
Fixes issue 2500.

Patch by Daniel Kang, daniel.d.kang at gmail

Modified:
   trunk/libavcodec/tiff.c

Modified: trunk/libavcodec/tiff.c
==============================================================================
--- trunk/libavcodec/tiff.c	Thu Jan  6 21:17:51 2011	(r26247)
+++ trunk/libavcodec/tiff.c	Thu Jan  6 23:12:55 2011	(r26248)
@@ -263,6 +263,10 @@ static int tiff_decode_tag(TiffContext *
         s->height = value;
         break;
     case TIFF_BPP:
+        if(count > 4){
+            av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count);
+            return -1;
+        }
         if(count == 1) s->bpp = value;
         else{
             switch(type){
@@ -278,10 +282,6 @@ static int tiff_decode_tag(TiffContext *
                 s->bpp = -1;
             }
         }
-        if(count > 4){
-            av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count);
-            return -1;
-        }
         switch(s->bpp*10 + count){
         case 11:
             s->avctx->pix_fmt = PIX_FMT_MONOBLACK;



More information about the ffmpeg-cvslog mailing list