aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpeg4videodec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-07 16:39:59 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-07 19:59:00 +0200
commit6c249392fa646f509823d5ce12d0c2515d8f31f2 (patch)
tree788b2517d6c2d7ced890c63c0b80747bd27f803a /libavcodec/mpeg4videodec.c
parent6560fa390e9a296276faaa22779936f187f05a96 (diff)
downloadffmpeg-6c249392fa646f509823d5ce12d0c2515d8f31f2.tar.gz
mpeg4videodec: make sure f/b_code are not invalid values.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpeg4videodec.c')
-rw-r--r--libavcodec/mpeg4videodec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index c87af8216e..99aecbb26a 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2073,6 +2073,7 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
s->f_code = get_bits(gb, 3); /* fcode_for */
if(s->f_code==0){
av_log(s->avctx, AV_LOG_ERROR, "Error, header damaged or not MPEG4 header (f_code=0)\n");
+ s->f_code=1;
return -1; // makes no sense to continue, as the MV decoding will break very quickly
}
}else
@@ -2080,6 +2081,11 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
if (s->pict_type == AV_PICTURE_TYPE_B) {
s->b_code = get_bits(gb, 3);
+ if(s->b_code==0){
+ av_log(s->avctx, AV_LOG_ERROR, "Error, header damaged or not MPEG4 header (b_code=0)\n");
+ s->b_code=1;
+ return -1; // makes no sense to continue, as the MV decoding will break very quickly
+ }
}else
s->b_code=1;