diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-04 18:58:38 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-01-06 18:28:33 +0100 |
commit | 4a495766d1e820264fdf5d62e8105a83853c7805 (patch) | |
tree | 474bd66bea0f84df31f7c2a2d5a7c3d937e1151f /doc/examples/transcoding.c | |
parent | cedb96db37236b6a02782b7747d2c5bf1211b9be (diff) | |
download | ffmpeg-4a495766d1e820264fdf5d62e8105a83853c7805.tar.gz |
doc/examples/transcoding: check encoder before using it
Fixes null pointer exception
Found-by: stoupeace
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bde27e1e617dfeb3c026f530f48a77f5ed8aa2ea)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'doc/examples/transcoding.c')
-rw-r--r-- | doc/examples/transcoding.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c index a8f4210e6e..d7c4a84de9 100644 --- a/doc/examples/transcoding.c +++ b/doc/examples/transcoding.c @@ -116,6 +116,10 @@ static int open_output_file(const char *filename) || dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) { /* in this example, we choose transcoding to same codec */ encoder = avcodec_find_encoder(dec_ctx->codec_id); + if (!encoder) { + av_log(NULL, AV_LOG_FATAL, "Neccessary encoder not found\n"); + return AVERROR_INVALIDDATA; + } /* In this example, we transcode to same properties (picture size, * sample rate etc.). These properties can be changed for output |