From 749e4c3bdc8cdff817c6e00d62543fc3882e8b28 Mon Sep 17 00:00:00 2001 From: Oneric Date: Tue, 13 Oct 2020 03:39:57 +0200 Subject: Avoid passing NULL as a %s parameter ass_msg's callback will most likely use vprintf. Passing NULL as %s to a _printf function is undefined behaviour. --- libass/ass.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libass') diff --git a/libass/ass.c b/libass/ass.c index 370afb8..63bd1ee 100644 --- a/libass/ass.c +++ b/libass/ass.c @@ -630,6 +630,8 @@ static int process_styles_line(ASS_Track *track, char *str) skip_spaces(&p); free(track->style_format); track->style_format = strdup(p); + if (!track->style_format) + return -1; ass_msg(track->library, MSGL_DBG2, "Style format: %s", track->style_format); if (track->track_type == TRACK_TYPE_ASS) @@ -768,6 +770,8 @@ static int process_events_line(ASS_Track *track, char *str) skip_spaces(&p); free(track->event_format); track->event_format = strdup(p); + if (!track->event_format) + return -1; ass_msg(track->library, MSGL_DBG2, "Event format: %s", track->event_format); if (track->track_type == TRACK_TYPE_ASS) custom_format_line_compatibility(track, p, ass_event_format); @@ -889,8 +893,10 @@ static int process_fonts_line(ASS_Track *track, char *str) decode_font(track); } track->parser_priv->fontname = strdup(p); + if (!track->parser_priv->fontname) + return -1; ass_msg(track->library, MSGL_V, "Fontname: %s", - track->parser_priv->fontname); + track->parser_priv->fontname); return 0; } -- cgit v1.2.3