Commit 258fa1f3 authored by michael's avatar michael

more error checks for the sequence header


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@2788 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 507544af
...@@ -2373,6 +2373,10 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, ...@@ -2373,6 +2373,10 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
if (get_bits1(&s->gb)) { if (get_bits1(&s->gb)) {
for(i=0;i<64;i++) { for(i=0;i<64;i++) {
v = get_bits(&s->gb, 8); v = get_bits(&s->gb, 8);
if(v==0){
av_log(s->avctx, AV_LOG_ERROR, "intra matrix damaged\n");
return -1;
}
j = s->intra_scantable.permutated[i]; j = s->intra_scantable.permutated[i];
s->intra_matrix[j] = v; s->intra_matrix[j] = v;
s->chroma_intra_matrix[j] = v; s->chroma_intra_matrix[j] = v;
...@@ -2394,6 +2398,10 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, ...@@ -2394,6 +2398,10 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
if (get_bits1(&s->gb)) { if (get_bits1(&s->gb)) {
for(i=0;i<64;i++) { for(i=0;i<64;i++) {
v = get_bits(&s->gb, 8); v = get_bits(&s->gb, 8);
if(v==0){
av_log(s->avctx, AV_LOG_ERROR, "inter matrix damaged\n");
return -1;
}
j = s->intra_scantable.permutated[i]; j = s->intra_scantable.permutated[i];
s->inter_matrix[j] = v; s->inter_matrix[j] = v;
s->chroma_inter_matrix[j] = v; s->chroma_inter_matrix[j] = v;
...@@ -2412,6 +2420,11 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, ...@@ -2412,6 +2420,11 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
s->chroma_inter_matrix[j] = v; s->chroma_inter_matrix[j] = v;
} }
} }
if(show_bits(&s->gb, 23) != 0){
av_log(s->avctx, AV_LOG_ERROR, "sequence header damaged\n");
return -1;
}
/* we set mpeg2 parameters so that it emulates mpeg1 */ /* we set mpeg2 parameters so that it emulates mpeg1 */
s->progressive_sequence = 1; s->progressive_sequence = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment