Browse Source

ffprobe: Fix null pointer dereference with color primaries

Found-by: AD-lab of venustech
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 837cb4325b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b2c39fcc3c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.1.11
Michael Niedermayer 8 years ago
parent
commit
5ff09443c5
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      ffprobe.c

+ 11
- 4
ffprobe.c View File

@@ -1789,6 +1789,16 @@ static void print_pkt_side_data(WriterContext *w,
writer_print_section_footer(w);
}

static void print_primaries(WriterContext *w, enum AVColorPrimaries color_primaries)
{
const char *val = av_color_primaries_name(color_primaries);
if (!val || color_primaries == AVCOL_PRI_UNSPECIFIED) {
print_str_opt("color_primaries", "unknown");
} else {
print_str("color_primaries", val);
}
}

static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int packet_idx)
{
char val_str[128];
@@ -2257,10 +2267,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
else
print_str_opt("color_transfer", av_color_transfer_name(par->color_trc));

if (par->color_primaries != AVCOL_PRI_UNSPECIFIED)
print_str("color_primaries", av_color_primaries_name(par->color_primaries));
else
print_str_opt("color_primaries", av_color_primaries_name(par->color_primaries));
print_primaries(w, par->color_primaries);

if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
print_str("chroma_location", av_chroma_location_name(par->chroma_location));


Loading…
Cancel
Save