[FFmpeg-cvslog] cmdutils: add missing check for ftell() return

Michael Niedermayer git at videolan.org
Thu Oct 18 01:14:04 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Oct 18 00:10:59 2012 +0200| [ce739e66f4f9154d74f4a84436238abb205152b9] | committer: Michael Niedermayer

cmdutils: add missing check for ftell() return

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

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

 cmdutils.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cmdutils.c b/cmdutils.c
index f4474f6..0163faf 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -1303,6 +1303,10 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
     fseek(f, 0, SEEK_END);
     *size = ftell(f);
     fseek(f, 0, SEEK_SET);
+    if (*size == (size_t)-1) {
+        av_log(NULL, AV_LOG_ERROR, "IO error: %s\n", strerror(errno));
+        return AVERROR(errno);
+    }
     *bufptr = av_malloc(*size + 1);
     if (!*bufptr) {
         av_log(NULL, AV_LOG_ERROR, "Could not allocate file buffer\n");



More information about the ffmpeg-cvslog mailing list