summaryrefslogtreecommitdiff
path: root/src/xine-engine/demux.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine/demux.c')
-rw-r--r--src/xine-engine/demux.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c
index ed802d8fa..59721aedc 100644
--- a/src/xine-engine/demux.c
+++ b/src/xine-engine/demux.c
@@ -39,6 +39,11 @@
#include <winsock.h>
#endif
+#ifdef MIN
+#undef MIN
+#endif
+#define MIN(a,b) ( (a) < (b) ) ? (a) : (b)
+
/*
#define LOG
*/
@@ -350,8 +355,9 @@ int xine_demux_read_header( input_plugin_t *input, unsigned char *buffer, off_t
return 0;
input->seek(input, 0, SEEK_SET);
} else if (input->get_capabilities(input) & INPUT_CAP_PREVIEW) {
- buf = xine_xmalloc(size);
- read_size = input->get_optional_data(input, buf, size);
+ buf = xine_xmalloc(MAX_PREVIEW_SIZE);
+ read_size = input->get_optional_data(input, buf, INPUT_OPTIONAL_DATA_PREVIEW);
+ read_size = MIN (read_size, size);
memcpy(buffer, buf, size);
free(buf);
} else {