Skip to content

Commit

Permalink
avformat/matroskaenc: Don't use NULL for %s format string
Browse files Browse the repository at this point in the history
The argument pertaining to a printf %s conversion specifier must not
be NULL, even if the precision (i.e. the number of characters to write)
is zero. If it is NULL, it is undefined behaviour.

Signed-off-by: Andreas Rheinhardt <[email protected]>
  • Loading branch information
mkver committed Jun 15, 2020
1 parent c784fe8 commit 6de6ce7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libavformat/matroskaenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2118,17 +2118,19 @@ static int mkv_write_vtt_blocks(AVFormatContext *s, AVIOContext *pb, const AVPac
mkv_track *track = &mkv->tracks[pkt->stream_index];
ebml_master blockgroup;
int id_size, settings_size, size;
uint8_t *id, *settings;
const char *id, *settings;
int64_t ts = track->write_dts ? pkt->dts : pkt->pts;
const int flags = 0;

id_size = 0;
id = av_packet_get_side_data(pkt, AV_PKT_DATA_WEBVTT_IDENTIFIER,
&id_size);
id = id ? id : "";

settings_size = 0;
settings = av_packet_get_side_data(pkt, AV_PKT_DATA_WEBVTT_SETTINGS,
&settings_size);
settings = settings ? settings : "";

size = id_size + 1 + settings_size + 1 + pkt->size;

Expand Down

0 comments on commit 6de6ce7

Please sign in to comment.