summaryrefslogtreecommitdiff
path: root/libavcodec/rv10enc.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-03-02 20:27:26 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-03 12:36:36 +0100
commit2578a546183da09d49d5bba8ab5e982dece1dede (patch)
treeca0fd077f6b2e48688dcae1e219f289189147fd8 /libavcodec/rv10enc.c
parent618021ea58cda5ce294efa53ce5a69ce27420ef8 (diff)
avcodec/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: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/rv10enc.c')
-rw-r--r--libavcodec/rv10enc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/rv10enc.c b/libavcodec/rv10enc.c
index 25411322a6..37efe6cca4 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,17 @@ 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, "Encoding frames with 4096 or more macroblocks");
+ 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)