Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-08-22 12:02:38 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2017-08-24 13:28:16 +0300
commitc1a9f5675b956acc2080cab1953d83d501c3d5d9 (patch)
tree7274baa81151f1384d06b84374db34a34a6b1e43
parentae37bbef4368f78ce3f4771100d12a2c26a69420 (diff)
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> (cherry picked from commit b2c39fcc3c0749490dc93bca80f56724878b55fe) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--ffprobe.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/ffprobe.c b/ffprobe.c
index ed8babf784..9df22b5944 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1732,6 +1732,16 @@ static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id
return ret;
}
+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, AVFormatContext *fmt_ctx, AVPacket *pkt, int packet_idx)
{
char val_str[128];
@@ -2187,10 +2197,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
else
print_str_opt("color_transfer", av_color_transfer_name(dec_ctx->color_trc));
- if (dec_ctx->color_primaries != AVCOL_PRI_UNSPECIFIED)
- print_str("color_primaries", av_color_primaries_name(dec_ctx->color_primaries));
- else
- print_str_opt("color_primaries", av_color_primaries_name(dec_ctx->color_primaries));
+ print_primaries(w, dec_ctx->color_primaries);
if (dec_ctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED)
print_str("chroma_location", av_chroma_location_name(dec_ctx->chroma_sample_location));