Message ID | 8CDE01C5-A070-48F3-B8BF-3BA1EB31B9E4@charliemonroe.net |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] Fix comparing NULL string when processing certain subtitle files. | expand |
Context | Check | Description |
---|---|---|
andriy/configurex86 | warning | Failed to apply patch |
andriy/configureppc | warning | Failed to apply patch |
Charlie Monroe: > 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@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) > Thanks for this patch. I will apply this (with the declaration-after-statement issue fixed) tomorrow unless someone objects to it or beats me to it. - Andreas
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]))
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@charliemonroe.net> --- libavcodec/movtextenc.c | 3 +++ 1 file changed, 3 insertions(+)