[FFmpeg-devel] [PATCH] Fix comparing NULL string when processing certain subtitle files.
Charlie Monroe
charlie at charliemonroe.net
Fri Dec 10 12:20:18 EET 2021
Hi,
I hope I'm submitting this fix correctly - some subtitles will cause FFmpeg to crash when searching for a font in movtextencode. One such subtitles file is appended. The crash occurrs in find_font_id where the name argument passed is NULL.
Here is an example command for reproducing the issue:
ffmpeg -i test.mp4 -i test.ass -c:v copy -c:a copy -c:s 'mov_text' out.mp4
Cheers,
Charlie
Signed-off-by: Charlie Monroe <charlie at charliemonroe.net>
---
libavcodec/movtextenc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c
index 5869942ec0..df3a2dd97a 100644
--- a/libavcodec/movtextenc.c
+++ b/libavcodec/movtextenc.c
@@ -494,6 +494,9 @@ static void mov_text_alpha_cb(void *priv, int alpha, int alpha_id)
static uint16_t find_font_id(MovTextContext *s, const char *name)
{
+ if (name == NULL)
+ return 1;
+
int i;
for (i = 0; i < s->font_count; i++) {
if (!strcmp(name, s->fonts[i]))
--
2.30.1 (Apple Git-130)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.ass
Type: application/octet-stream
Size: 69503 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20211210/19ca7e3e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 788 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20211210/19ca7e3e/attachment-0001.obj>
More information about the ffmpeg-devel
mailing list