[Ffmpeg-devel] [PATCH] uncheck qscale diff can cause crash

Reimar Döffinger Reimar.Doeffinger
Thu Sep 15 15:02:38 CEST 2005


Hi,
the attached patch adds a missing check for the qscale delta value. The
check and error message were copied from another place where this check
is already done, no idea if they are right here too.
Please check and comment...

Greetings,
Reimar D??ffinger
-------------- next part --------------
Index: libavcodec/h264.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/h264.c,v
retrieving revision 1.154
diff -u -r1.154 h264.c
--- libavcodec/h264.c	10 Sep 2005 01:13:10 -0000	1.154
+++ libavcodec/h264.c	15 Sep 2005 12:57:31 -0000
@@ -6044,6 +6044,10 @@
         }
 
         h->last_qscale_diff = dqp = decode_cabac_mb_dqp( h );
+        if( dqp > 25 || dqp < -26 ){
+            av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dqp, s->mb_x, s->mb_y);
+            return -1;
+        }
         s->qscale += dqp;
         if(((unsigned)s->qscale) > 51){
             if(s->qscale<0) s->qscale+= 52;



More information about the ffmpeg-devel mailing list