changeset 25893:638493dc056e

Check that index is still within bounds of samples array. Previous check is not enough and the code is not performance critical so do it the easy way.
author reimar
date Tue, 29 Jan 2008 22:14:00 +0000
parents 68a400e63e67
children f591a403581c
files libmpdemux/demux_mov.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mov.c	Tue Jan 29 22:13:47 2008 +0000
+++ b/libmpdemux/demux_mov.c	Tue Jan 29 22:14:00 2008 +0000
@@ -238,6 +238,8 @@
     s=0;
     for(j=0;j<trak->durmap_size;j++){
 	for(i=0;i<trak->durmap[j].num;i++){
+	    if (s >= trak->samples_size)
+		break;
 	    trak->samples[s].pts=pts;
 	    ++s;
 	    pts+=trak->durmap[j].dur;
@@ -249,6 +251,8 @@
     for(j=0;j<trak->chunks_size;j++){
 	off_t pos=trak->chunks[j].pos;
 	for(i=0;i<trak->chunks[j].size;i++){
+	    if (s >= trak->samples_size)
+		break;
 	    trak->samples[s].pos=pos;
 	    mp_msg(MSGT_DEMUX, MSGL_DBG3, "Sample %5d: pts=%8d  off=0x%08X  size=%d\n",s,
 		trak->samples[s].pts,