summaryrefslogtreecommitdiff
path: root/libavcodec/rv10enc.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-03-03 21:31:15 +0100
committerAnton Khirnov <anton@khirnov.net>2015-03-05 14:49:16 +0100
commit66624ed6319cb1a959256fe1a717fec5b748fbfa (patch)
treee10aa0329f8850e7f67bc5978a830e7f66118ca6 /libavcodec/rv10enc.c
parent9c09fbd8053292267cdc4b542913ceced43ea3a9 (diff)
rv10: check size of s->mb_width * s->mb_height
If it doesn't fit into 12 bits it triggers an assertion. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/rv10enc.c')
-rw-r--r--libavcodec/rv10enc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/rv10enc.c b/libavcodec/rv10enc.c
index ca760524a8..2eca9c3c88 100644
--- a/libavcodec/rv10enc.c
+++ b/libavcodec/rv10enc.c
@@ -28,7 +28,7 @@
#include "mpegvideo.h"
#include "put_bits.h"
-void ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number)
+int ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number)
{
int full_frame= 0;
@@ -48,12 +48,18 @@ void ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number)
/* if multiple packets per frame are sent, the position at which
to display the macroblocks is coded here */
if(!full_frame){
+ if (s->mb_width * s->mb_height >= (1U << 12)) {
+ avpriv_report_missing_feature(s->avctx, "Encoding frames with %d (>= 4096) macroblocks",
+ s->mb_width * s->mb_height);
+ return AVERROR(ENOSYS);
+ }
put_bits(&s->pb, 6, 0); /* mb_x */
put_bits(&s->pb, 6, 0); /* mb_y */
put_bits(&s->pb, 12, s->mb_width * s->mb_height);
}
put_bits(&s->pb, 3, 0); /* ignored */
+ return 0;
}
FF_MPV_GENERIC_CLASS(rv10)