OSDN Git Service

check region depth for validity
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Nov 2007 20:14:46 +0000 (20:14 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 19 Nov 2007 20:14:46 +0000 (20:14 +0000)
(32/64/128 would crash at least due to 1<<depth allocation later,
and no i do not have a sample file)

Originally committed as revision 11062 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/dvbsubdec.c

index b410a24..b51603f 100644 (file)
@@ -1035,6 +1035,10 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx,
     }
 
     region->depth = 1 << (((*buf++) >> 2) & 7);
+    if(region->depth<2 || region->depth>8){
+        av_log(avctx, AV_LOG_ERROR, "region depth %d is invalid\n", region->depth);
+        region->depth= 4;
+    }
     region->clut = *buf++;
 
     if (region->depth == 8)