[FFmpeg-devel] [PATCH 2/7] ansi: fix uninitialized height/width case.

Clément Bœsch ubitux at gmail.com
Thu Sep 1 02:30:19 CEST 2011


---
 libavcodec/ansi.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index ebcc288..8baaec3 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -159,7 +159,7 @@ static void draw_char(AVCodecContext *avctx, int c)
 static int execute_code(AVCodecContext * avctx, int c)
 {
     AnsiContext *s = avctx->priv_data;
-    int ret, i, width, height;
+    int ret, i, width = 0, height = 0;
     switch(c) {
     case 'A': //Cursor Up
         s->y = FFMAX(s->y - (s->nb_args > 0 ? s->args[0]*s->font_height : s->font_height), 0);
@@ -218,6 +218,8 @@ static int execute_code(AVCodecContext * avctx, int c)
         default:
             av_log_ask_for_sample(avctx, "unsupported screen mode\n");
         }
+        if (!width && !height)
+            break;
         if (width != avctx->width || height != avctx->height) {
             if (s->frame.data[0])
                 avctx->release_buffer(avctx, &s->frame);
-- 
1.7.6.1



More information about the ffmpeg-devel mailing list