diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2009-10-17 20:37:58 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2009-10-17 20:37:58 +0000 |
commit | a4cb675124a906126ba4ab307f0c17716f6d9adb (patch) | |
tree | 9559726a78af2af12e33fec3c42e9842fc040523 | |
parent | c69b3e0dc1b3bf9dca8352f575a6dd7a29aa9fdc (diff) | |
download | ffmpeg-a4cb675124a906126ba4ab307f0c17716f6d9adb.tar.gz |
Avoid segfault for empty input files
Originally committed as revision 20265 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/utils.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 1b23a00f51..e38a01c17a 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -469,6 +469,12 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, /* read probe data */ pd->buf= av_realloc(pd->buf, probe_size + AVPROBE_PADDING_SIZE); pd->buf_size = get_buffer(pb, pd->buf, probe_size); + + if ((int)pd->buf_size < 0) { + err = pd->buf_size; + goto fail; + } + memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE); if (url_fseek(pb, 0, SEEK_SET) < 0) { url_fclose(pb); |