changeset 5293:f18f00a37c22 libavformat

Avoid segfault for empty input files
author vitor
date Sat, 17 Oct 2009 20:37:58 +0000
parents 2568a59ac5fe
children f16b8dab057b
files utils.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Sat Oct 17 14:07:28 2009 +0000
+++ b/utils.c	Sat Oct 17 20:37:58 2009 +0000
@@ -469,6 +469,12 @@
             /* 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);