Commit ce739e66 authored by Michael Niedermayer's avatar Michael Niedermayer

cmdutils: add missing check for ftell() return

Fixed CID703706
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 916352f2
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment