ffmpeg | branch: master | Charlie Monroe <[email protected]> | Fri Dec 
10 11:20:18 2021 +0100| [34aee50a7f5a4b36f9f7daf827422d345c7868ed] | committer: 
Andreas Rheinhardt

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 <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=34aee50a7f5a4b36f9f7daf827422d345c7868ed
---

 libavcodec/movtextenc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
index 5869942ec0..221cd76fea 100644
--- a/libavcodec/movtextenc.c
+++ b/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;
     }

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to