summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-08-25 00:01:57 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-08-25 00:01:57 +0000
commitba17363ff71e68d89b64bc6f129460e9056b9de6 (patch)
treeed4e0ad3a7344a0ff8e0097aa9c1c3860618750b /libavcodec/h264.c
parent3fc9e78f1fe7740fda079068f242de56a74f2429 (diff)
prevent assert failures and infinite loops with broken streams
Originally committed as revision 4538 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index c21d0930d2..40f3c1739a 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -5363,6 +5363,8 @@ static int decode_cabac_mb_dqp( H264Context *h) {
else
ctx = 3;
val++;
+ if(val > 52) //prevent infinite loop
+ return INT_MIN;
}
if( val&0x01 )
@@ -6548,7 +6550,7 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8
bS[0] = bS[1] = bS[2] = bS[3] = 3;
} else {
// TODO
- assert(0);
+ av_log(h->s.avctx, AV_LOG_ERROR, "both non intra (TODO)\n");
}
/* Filter edge */
// Do not use s->qscale as luma quantizer because it has not the same
@@ -6569,7 +6571,7 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8
bS[0] = bS[1] = bS[2] = bS[3] = 3;
} else {
// TODO
- assert(0);
+ av_log(h->s.avctx, AV_LOG_ERROR, "both non intra (TODO)\n");
}
/* Filter edge */
// Do not use s->qscale as luma quantizer because it has not the same
@@ -6701,7 +6703,7 @@ static int decode_slice(H264Context *h){
if(ret>=0) ret = decode_mb_cabac(h);
- hl_decode_mb(h);
+ if(ret>=0) hl_decode_mb(h);
s->mb_y--;
}
eos = get_cabac_terminate( &h->cabac );