diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-02 02:15:03 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-02 02:15:40 +0200 |
commit | e91fd754c63de7fd3cb7fdea8974166db362e387 (patch) | |
tree | 78333967f25859cb84856c45de41d0a35f4f97a7 | |
parent | c1f2c4c3b49277d65b71ccdd3b6b2878f1b593eb (diff) | |
download | ffmpeg-e91fd754c63de7fd3cb7fdea8974166db362e387.tar.gz |
avcodec/ansi: Check x/y
This prevents out of array accesses
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/ansi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c index 93915f835f..07eeaff7b4 100644 --- a/libavcodec/ansi.c +++ b/libavcodec/ansi.c @@ -243,6 +243,8 @@ static int execute_code(AVCodecContext * avctx, int c) default: avpriv_request_sample(avctx, "Unsupported screen mode"); } + s->x = av_clip(s->x, 0, width - FONT_WIDTH); + s->y = av_clip(s->y, 0, height - s->font_height); if (width != avctx->width || height != avctx->height) { av_frame_unref(s->frame); avcodec_set_dimensions(avctx, width, height); @@ -336,6 +338,8 @@ static int execute_code(AVCodecContext * avctx, int c) avpriv_request_sample(avctx, "Unknown escape code"); break; } + s->x = av_clip(s->x, 0, avctx->width - FONT_WIDTH); + s->y = av_clip(s->y, 0, avctx->height - s->font_height); return 0; } |