aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpeg12.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-08-26 01:29:40 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-26 01:29:40 +0200
commit876d1d796bd80c75e3e6a7a458e3143cfe5c9474 (patch)
tree949cc4c9120dc58512d84998adcb949d173cd9c0 /libavcodec/mpeg12.c
parent7c4e4c6a0664bf668f4b7766a06f30096e0601f3 (diff)
parentf913eeea43078b3b9052efd8d8d29e7b29b39208 (diff)
downloadffmpeg-876d1d796bd80c75e3e6a7a458e3143cfe5c9474.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: vp6: partially propagate huffman tree building errors during coeff model parsing and fix misspelling mpeg12: propagate chunk decode errors and fix conditional indentation vc1: fix VC-1 Pulldown handling. VC1: Fix first/last row checks with slices mp4: Handle non-trivial ES Descriptors. vc1: properly zero coded_block[] edges on new slice entry. Conflicts: libavcodec/vc1dec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r--libavcodec/mpeg12.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 3d9935b203..069cd000a3 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1948,6 +1948,8 @@ static int slice_decode_thread(AVCodecContext *c, void *arg){
//av_log(c, AV_LOG_DEBUG, "ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n",
//ret, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, s->start_mb_y, s->end_mb_y, s->error_count);
if(ret < 0){
+ if (c->error_recognition >= FF_ER_EXPLODE)
+ return AVERROR_INVALIDDATA;
if(s->resync_mb_x>=0 && s->resync_mb_y>=0)
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, AC_ERROR|DC_ERROR|MV_ERROR);
}else{
@@ -2301,8 +2303,10 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
s->slice_count= 0;
- if(avctx->extradata && !avctx->frame_number)
- decode_chunks(avctx, picture, data_size, avctx->extradata, avctx->extradata_size);
+ if(avctx->extradata && !avctx->frame_number &&
+ decode_chunks(avctx, picture, data_size, avctx->extradata, avctx->extradata_size) < 0 &&
+ avctx->error_recognition >= FF_ER_EXPLODE)
+ return AVERROR_INVALIDDATA;
return decode_chunks(avctx, picture, data_size, buf, buf_size);
}
@@ -2355,11 +2359,13 @@ static int decode_chunks(AVCodecContext *avctx,
switch(start_code) {
case SEQ_START_CODE:
if(last_code == 0){
- mpeg1_decode_sequence(avctx, buf_ptr,
- input_size);
+ mpeg1_decode_sequence(avctx, buf_ptr,
+ input_size);
s->sync=1;
}else{
av_log(avctx, AV_LOG_ERROR, "ignoring SEQ_START_CODE after %X\n", last_code);
+ if (avctx->error_recognition >= FF_ER_EXPLODE)
+ return AVERROR_INVALIDDATA;
}
break;
@@ -2388,6 +2394,8 @@ static int decode_chunks(AVCodecContext *avctx,
last_code= PICTURE_START_CODE;
}else{
av_log(avctx, AV_LOG_ERROR, "ignoring pic after %X\n", last_code);
+ if (avctx->error_recognition >= FF_ER_EXPLODE)
+ return AVERROR_INVALIDDATA;
}
break;
case EXT_START_CODE:
@@ -2399,6 +2407,8 @@ static int decode_chunks(AVCodecContext *avctx,
mpeg_decode_sequence_extension(s);
}else{
av_log(avctx, AV_LOG_ERROR, "ignoring seq ext after %X\n", last_code);
+ if (avctx->error_recognition >= FF_ER_EXPLODE)
+ return AVERROR_INVALIDDATA;
}
break;
case 0x2:
@@ -2415,6 +2425,8 @@ static int decode_chunks(AVCodecContext *avctx,
mpeg_decode_picture_coding_extension(s);
}else{
av_log(avctx, AV_LOG_ERROR, "ignoring pic cod ext after %X\n", last_code);
+ if (avctx->error_recognition >= FF_ER_EXPLODE)
+ return AVERROR_INVALIDDATA;
}
break;
}
@@ -2431,6 +2443,8 @@ static int decode_chunks(AVCodecContext *avctx,
s->sync=1;
}else{
av_log(avctx, AV_LOG_ERROR, "ignoring GOP_START_CODE after %X\n", last_code);
+ if (avctx->error_recognition >= FF_ER_EXPLODE)
+ return AVERROR_INVALIDDATA;
}
break;
default:
@@ -2475,6 +2489,8 @@ static int decode_chunks(AVCodecContext *avctx,
if(!s2->pict_type){
av_log(avctx, AV_LOG_ERROR, "Missing picture start code\n");
+ if (avctx->error_recognition >= FF_ER_EXPLODE)
+ return AVERROR_INVALIDDATA;
break;
}
@@ -2485,6 +2501,8 @@ static int decode_chunks(AVCodecContext *avctx,
}
if(!s2->current_picture_ptr){
av_log(avctx, AV_LOG_ERROR, "current_picture not initialized\n");
+ if (avctx->error_recognition >= FF_ER_EXPLODE)
+ return AVERROR_INVALIDDATA;
return -1;
}
@@ -2514,6 +2532,8 @@ static int decode_chunks(AVCodecContext *avctx,
emms_c();
if(ret < 0){
+ if (avctx->error_recognition >= FF_ER_EXPLODE)
+ return AVERROR_INVALIDDATA;
if(s2->resync_mb_x>=0 && s2->resync_mb_y>=0)
ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR);
}else{