summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/h264.c3
-rw-r--r--libavcodec/mpegvideo.h2
2 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index cb026badc4..d90fefc7df 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -5430,6 +5430,9 @@ static inline int decode_seq_parameter_set(H264Context *h){
}
sps->ref_frame_count= get_ue_golomb(&s->gb);
+ if(sps->ref_frame_count > MAX_PICTURE_COUNT-2){
+ av_log(h->s.avctx, AV_LOG_ERROR, "too many reference frames\n");
+ }
sps->gaps_in_frame_num_allowed_flag= get_bits1(&s->gb);
sps->mb_width= get_ue_golomb(&s->gb) + 1;
sps->mb_height= get_ue_golomb(&s->gb) + 1;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index d0ad4f066b..0c317202c1 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -50,7 +50,7 @@ enum OutputFormat {
#define MAX_THREADS 8
-#define MAX_PICTURE_COUNT 15
+#define MAX_PICTURE_COUNT 32
#define ME_MAP_SIZE 64
#define ME_MAP_SHIFT 3