avcodec/movtextenc: Check for existence of font name before using it

Fixes crashes if the font name is NULL (which it is if a \fn tag
is not followed by a font name).

Signed-off-by: Charlie Monroe <charlie@charliemonroe.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
pull/376/head
Charlie Monroe 3 years ago committed by Andreas Rheinhardt
parent 41b077762c
commit 34aee50a7f
  1. 6
      libavcodec/movtextenc.c

@ -494,8 +494,10 @@ static void mov_text_alpha_cb(void *priv, int alpha, int alpha_id)
static uint16_t find_font_id(MovTextContext *s, const char *name)
{
int i;
for (i = 0; i < s->font_count; i++) {
if (!name)
return 1;
for (int i = 0; i < s->font_count; i++) {
if (!strcmp(name, s->fonts[i]))
return i + 1;
}

Loading…
Cancel
Save