[FFmpeg-cvslog] doc/examples/decoding_encoding: Check all av_samples_get_buffer_size() returns

Michael Niedermayer git at videolan.org
Fri Jan 31 03:34:00 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jan 31 03:27:37 2014 +0100| [a85a718f26ba9078613fe735a2b7d4bafeaa7b65] | committer: Michael Niedermayer

doc/examples/decoding_encoding: Check all av_samples_get_buffer_size() returns

Fixed CID1135755
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a85a718f26ba9078613fe735a2b7d4bafeaa7b65
---

 doc/examples/decoding_encoding.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/examples/decoding_encoding.c b/doc/examples/decoding_encoding.c
index 69ecb9b..c3b501c 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;



More information about the ffmpeg-cvslog mailing list