Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | Subject: [PATCH] ffprobe: Fix null pointer dereference with color primaries |
| 2 | |
| 3 | Found-by: AD-lab of venustech |
| 4 | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> |
| 5 | |
| 6 | CVE: CVE-2017-14225 |
| 7 | Upstream-Status: Backport |
| 8 | |
| 9 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> |
| 10 | --- |
| 11 | ffprobe.c | 15 +++++++++++---- |
| 12 | 1 file changed, 11 insertions(+), 4 deletions(-) |
| 13 | |
| 14 | diff --git a/ffprobe.c b/ffprobe.c |
| 15 | index a219fc1..df22b30 100644 |
| 16 | --- a/ffprobe.c |
| 17 | +++ b/ffprobe.c |
| 18 | @@ -1899,6 +1899,16 @@ static void print_pkt_side_data(WriterContext *w, |
| 19 | writer_print_section_footer(w); |
| 20 | } |
| 21 | |
| 22 | +static void print_primaries(WriterContext *w, enum AVColorPrimaries color_primaries) |
| 23 | +{ |
| 24 | + const char *val = av_color_primaries_name(color_primaries); |
| 25 | + if (!val || color_primaries == AVCOL_PRI_UNSPECIFIED) { |
| 26 | + print_str_opt("color_primaries", "unknown"); |
| 27 | + } else { |
| 28 | + print_str("color_primaries", val); |
| 29 | + } |
| 30 | +} |
| 31 | + |
| 32 | static void clear_log(int need_lock) |
| 33 | { |
| 34 | int i; |
| 35 | @@ -2420,10 +2430,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id |
| 36 | else |
| 37 | print_str_opt("color_transfer", av_color_transfer_name(par->color_trc)); |
| 38 | |
| 39 | - if (par->color_primaries != AVCOL_PRI_UNSPECIFIED) |
| 40 | - print_str("color_primaries", av_color_primaries_name(par->color_primaries)); |
| 41 | - else |
| 42 | - print_str_opt("color_primaries", av_color_primaries_name(par->color_primaries)); |
| 43 | + print_primaries(w, par->color_primaries); |
| 44 | |
| 45 | if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED) |
| 46 | print_str("chroma_location", av_chroma_location_name(par->chroma_location)); |
| 47 | -- |
| 48 | 2.1.0 |
| 49 | |