[FFmpeg-cvslog] doc/examples/transcoding: check encoder before using it
Michael Niedermayer
git at videolan.org
Mon Dec 15 15:25:03 CET 2014
ffmpeg | branch: release/2.5 | Michael Niedermayer <michaelni at gmx.at> | Thu Dec 4 18:58:38 2014 +0100| [3bcd1daad7993d2d23704582260fe45f4823a16d] | committer: Michael Niedermayer
doc/examples/transcoding: check encoder before using it
Fixes null pointer exception
Found-by: stoupeace
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit bde27e1e617dfeb3c026f530f48a77f5ed8aa2ea)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3bcd1daad7993d2d23704582260fe45f4823a16d
---
doc/examples/transcoding.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c
index 759c628..5572461 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
More information about the ffmpeg-cvslog
mailing list