diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-01-31 03:27:37 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-01-31 03:27:37 +0100 |
commit | a85a718f26ba9078613fe735a2b7d4bafeaa7b65 (patch) | |
tree | bb838ff3bfa4902de317ab2324c0327261153974 /doc/examples | |
parent | c89f8f80cc83622471eaf99e451e78df68475e19 (diff) | |
download | ffmpeg-a85a718f26ba9078613fe735a2b7d4bafeaa7b65.tar.gz |
doc/examples/decoding_encoding: Check all av_samples_get_buffer_size() returns
Fixed CID1135755
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/decoding_encoding.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/examples/decoding_encoding.c b/doc/examples/decoding_encoding.c index 69ecb9bdf7..c3b501cf69 100644 --- a/doc/examples/decoding_encoding.c +++ b/doc/examples/decoding_encoding.c @@ -307,6 +307,11 @@ static void audio_decode_example(const char *outfilename, const char *filename) int data_size = av_samples_get_buffer_size(NULL, c->channels, decoded_frame->nb_samples, c->sample_fmt, 1); + if (data_size < 0) { + /* This should not occur, checking just for paranoia */ + fprintf(stderr, "Failed to calculate data size\n"); + exit(1); + } fwrite(decoded_frame->data[0], 1, data_size, outfile); } avpkt.size -= len; |