changeset 22315:0a0191bc366d

10l, avoid crash on invalid subtitle id
author reimar
date Sat, 24 Feb 2007 10:19:41 +0000
parents ead0275fdc2c
children f3d7a1b58a82
files libmpdemux/demux_mov.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mov.c	Sat Feb 24 09:45:16 2007 +0000
+++ b/libmpdemux/demux_mov.c	Sat Feb 24 10:19:41 2007 +0000
@@ -2155,9 +2155,11 @@
     
     ++trak->pos;
 
-    if (demuxer->sub->id >= 0) {
+    trak = NULL;
+    if (demuxer->sub->id >= 0 && demuxer->sub->id < priv->track_db)
+      trak = priv->tracks[demuxer->sub->id];
+    if (trak) {
       int samplenr = 0;
-      trak = priv->tracks[demuxer->sub->id];
       while (samplenr < trak->samples_size) {
         double subpts = (double)trak->samples[samplenr].pts / (double)trak->timescale;
         if (subpts >= pts) break;