aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ansi.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2013-10-27 18:14:02 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2013-11-03 11:51:40 +0100
commit3ea5f64ffff0a51f62922efd2e2bc231b13b2179 (patch)
treece520f2250bf8a5e2046f09312950e58fae97977 /libavcodec/ansi.c
parentc0bba95c2363641d3297b3852b2ece1474cda295 (diff)
downloadffmpeg-3ea5f64ffff0a51f62922efd2e2bc231b13b2179.tar.gz
ansi: fix possible use of uninitialized variables
Diffstat (limited to 'libavcodec/ansi.c')
-rw-r--r--libavcodec/ansi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index 3f30ae90f5..95b5be4678 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -165,7 +165,10 @@ 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;
+ int width = 0;
+ int 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);
@@ -224,7 +227,8 @@ static int execute_code(AVCodecContext * avctx, int c)
default:
avpriv_request_sample(avctx, "Unsupported screen mode");
}
- if (width != avctx->width || height != avctx->height) {
+ if (width != 0 && height != 0 &&
+ (width != avctx->width || height != avctx->height)) {
av_frame_unref(s->frame);
ret = ff_set_dimensions(avctx, width, height);
if (ret < 0)