Commit f4017925 authored by Luca Barbato's avatar Luca Barbato Committed by Vittorio Giovara

vf_drawtext: Do not leak the mmapped textfile

And validate its size while at it.

CC: libav-stable@libav.org
Bug-Id: CID 1244189
parent 530c1441
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment