diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-08-22 11:02:38 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-09-10 01:33:28 +0200 |
commit | 5474a7e93b8ea0be1157ac9cf93c1511eccae7b0 (patch) | |
tree | 9879d9c1b7dfe2a46f93e9f9f71caa59d6e1e4c2 | |
parent | eea01de3ff157180d04782cea9a09072408d723a (diff) | |
download | ffmpeg-5474a7e93b8ea0be1157ac9cf93c1511eccae7b0.tar.gz |
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 837cb4325b712ff1aab531bf41668933f61d75d2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | ffprobe.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -1899,6 +1899,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 clear_log(int need_lock) { int i; @@ -2420,10 +2430,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)); |