diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2014-10-17 10:07:10 +0100 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2014-10-18 16:15:09 +0100 |
commit | f401792595dd7760f531e8a3bd2336e9033bd45a (patch) | |
tree | 520f818b7f9f81eb4a444bd2dd48e87c57a77e5f | |
parent | 530c1441fd1426b6a4bb33485ff3226e1ae0ad45 (diff) | |
download | ffmpeg-f401792595dd7760f531e8a3bd2336e9033bd45a.tar.gz |
vf_drawtext: Do not leak the mmapped textfile
And validate its size while at it.
CC: libav-stable@libav.org
Bug-Id: CID 1244189
-rw-r--r-- | libavfilter/vf_drawtext.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index 892104dade..d954fdf2cd 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -398,8 +398,11 @@ static av_cold int init(AVFilterContext *ctx) return err; } - if (!(s->text = av_malloc(textbuf_size+1))) + if (textbuf_size > SIZE_MAX - 1 || + !(s->text = av_malloc(textbuf_size + 1))) { + av_file_unmap(textbuf, textbuf_size); return AVERROR(ENOMEM); + } memcpy(s->text, textbuf, textbuf_size); s->text[textbuf_size] = 0; av_file_unmap(textbuf, textbuf_size); |