[MPlayer-cvslog] r20894 - trunk/libmpdemux/asfheader.c

reimar subversion at mplayerhq.hu
Mon Nov 13 20:16:39 CET 2006


Author: reimar
Date: Mon Nov 13 20:16:39 2006
New Revision: 20894

Modified:
   trunk/libmpdemux/asfheader.c

Log:
Try to handle oversized asf headers by ignoring anything beyond the first MB


Modified: trunk/libmpdemux/asfheader.c
==============================================================================
--- trunk/libmpdemux/asfheader.c	(original)
+++ trunk/libmpdemux/asfheader.c	Mon Nov 13 20:16:39 2006
@@ -231,6 +231,7 @@
 
 int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
   int hdr_len = asf->header.objh.size - sizeof(asf->header);
+  int hdr_skip = 0;
   char *hdr = NULL;
   char guid_buffer[16];
   int pos, start = stream_tell(demuxer->stream);
@@ -251,9 +252,10 @@
   }
     
   if (hdr_len > 1024 * 1024) {
-    mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_HeaderSizeOver1MB,
+    mp_msg(MSGT_HEADER, MSGL_ERR, MSGTR_MPDEMUX_ASFHDR_HeaderSizeOver1MB,
 			hdr_len);
-    return 0;
+    hdr_skip = hdr_len - 1024 * 1024;
+    hdr_len = 1024 * 1024;
   }
   hdr = malloc(hdr_len);
   if (!hdr) {
@@ -262,6 +264,8 @@
     return 0;
   }
   stream_read(demuxer->stream, hdr, hdr_len);
+  if (hdr_skip)
+    stream_skip(demuxer->stream, hdr_skip);
   if (stream_eof(demuxer->stream)) {
     mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_EOFWhileReadingHeader);
     goto err_out;



More information about the MPlayer-cvslog mailing list