changeset 29696:d3a6947ca46a

Check for grow_array allocation failure.
author reimar
date Wed, 30 Sep 2009 07:48:01 +0000
parents 7eaa16c03a87
children 1cd8a8e2c144
files libmpdemux/demux_mkv.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c	Wed Sep 30 07:45:10 2009 +0000
+++ b/libmpdemux/demux_mkv.c	Wed Sep 30 07:48:01 2009 +0000
@@ -245,6 +245,10 @@
 
   grow_array(&mkv_d->cluster_positions, mkv_d->num_cluster_pos,
              sizeof(uint64_t));
+  if (!mkv_d->cluster_positions) {
+    mkv_d->num_cluster_pos = 0;
+    return;
+  }
   mkv_d->cluster_positions[mkv_d->num_cluster_pos++] = position;
 }
 
@@ -1088,6 +1092,10 @@
           && pos != EBML_UINT_INVALID)
         {
           grow_array(&mkv_d->indexes, mkv_d->num_indexes, sizeof(mkv_index_t));
+          if (!mkv_d->indexes) {
+            mkv_d->num_indexes = 0;
+            break;
+          }
           mkv_d->indexes[mkv_d->num_indexes].tnum = track;
           mkv_d->indexes[mkv_d->num_indexes].timecode = time;
           mkv_d->indexes[mkv_d->num_indexes].filepos =mkv_d->segment_start+pos;