[MPlayer-cvslog] r33997 - trunk/libmpdemux/demuxer.c

reimar subversion at mplayerhq.hu
Thu Aug 18 20:32:53 CEST 2011


Author: reimar
Date: Thu Aug 18 20:32:53 2011
New Revision: 33997

Log:
Simply drop packets for which new_demux_packet allocation fails.
This allows to play some corrupted files instead of crashing.

Modified:
   trunk/libmpdemux/demuxer.c

Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c	Mon Aug 15 23:28:19 2011	(r33996)
+++ trunk/libmpdemux/demuxer.c	Thu Aug 18 20:32:53 2011	(r33997)
@@ -593,6 +593,7 @@ void ds_add_packet(demux_stream_t *ds, d
             ds_add_packet_internal(ds, dp);
         } else if (parsed_len) {
             demux_packet_t *dp2 = new_demux_packet(parsed_len);
+            if (!dp2) return;
             dp2->pos = dp->pos;
             dp2->pts = dp->pts; // should be parser->pts but that works badly
             memcpy(dp2->buffer, parsed_start, parsed_len);
@@ -608,6 +609,7 @@ void ds_read_packet(demux_stream_t *ds, 
                     double pts, off_t pos, int flags)
 {
     demux_packet_t *dp = new_demux_packet(len);
+    if (!dp) return;
     len = stream_read(stream, dp->buffer, len);
     resize_demux_packet(dp, len);
     dp->pts = pts;
@@ -713,6 +715,7 @@ int ds_fill_buffer(demux_stream_t *ds)
             ds_parse(ds->sh, &parsed_start, &parsed_len, MP_NOPTS_VALUE, 0);
             if (parsed_len) {
                 demux_packet_t *dp2 = new_demux_packet(parsed_len);
+                if (!dp2) continue;
                 dp2->pts = MP_NOPTS_VALUE;
                 memcpy(dp2->buffer, parsed_start, parsed_len);
                 ds_add_packet_internal(ds, dp2);


More information about the MPlayer-cvslog mailing list