avcodec/g2meet: Check monochrome cursor width
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 14 Jun 2013 19:13:47 +0000 (21:13 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 14 Jun 2013 19:14:31 +0000 (21:14 +0200)
Fixes out of array write

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/g2meet.c

index 2aa9b2b..09ed7ce 100644 (file)
@@ -514,6 +514,11 @@ static int g2m_load_cursor(AVCodecContext *avctx, G2MContext *c,
         return AVERROR_PATCHWELCOME;
     }
 
+    if (cursor_fmt == 1 && cursor_w % 32) {
+        avpriv_report_missing_feature(avctx, "odd monochrome cursor width %d", cursor_w);
+        return AVERROR_PATCHWELCOME;
+    }
+
     tmp = av_realloc(c->cursor, cursor_stride * cursor_h);
     if (!tmp) {
         av_log(avctx, AV_LOG_ERROR, "Cannot allocate cursor buffer\n");