summaryrefslogtreecommitdiff
path: root/cmdutils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-18 00:10:59 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-18 00:10:59 +0200
commitce739e66f4f9154d74f4a84436238abb205152b9 (patch)
treeea6153c52e7f202e638ce8d6f8c4f6abdb703aae /cmdutils.c
parent916352f282855e3e4e86a39df9452fead2aa0771 (diff)
cmdutils: add missing check for ftell() return
Fixed CID703706 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'cmdutils.c')
-rw-r--r--cmdutils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmdutils.c b/cmdutils.c
index f4474f61b6..0163faf13d 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");