changeset 18465:c3c68110f601

10^100l c++ declarations
author rfelker
date Sat, 13 May 2006 05:48:16 +0000
parents 4fd5519c1526
children 028e4c7a749e
files libmpdemux/demux_ogg.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ogg.c	Fri May 12 22:33:42 2006 +0000
+++ b/libmpdemux/demux_ogg.c	Sat May 13 05:48:16 2006 +0000
@@ -8,6 +8,7 @@
 #include <string.h>
 #include <assert.h>
 #include <math.h>
+#include <limits.h>
 
 #include "mp_msg.h"
 #include "help_mp.h"
@@ -348,10 +349,11 @@
     else if (ogg_d->vi_inited)
     {
        vorbis_info *vi;
+       int32_t blocksize;
        
        // When we dump the audio, there is no vi, but we don't care of timestamp in this case
        vi = &(ogg_d->vi);
-       int32_t blocksize = vorbis_packet_blocksize(vi,pack) / samplesize;
+       blocksize = vorbis_packet_blocksize(vi,pack) / samplesize;
        // Calculate the timestamp if the packet don't have any
        if(pack->granulepos == -1) {
 	  pack->granulepos = os->lastpos;
@@ -663,7 +665,8 @@
       demux_ogg_read_packet(os,&op,context,&pts,&flags,samplesize);
       if(op.granulepos >= 0) ogg_d->final_granulepos = op.granulepos;
       if(index_mode == 2 && (flags || (os->vorbis && op.granulepos >= 0))) {
-	ogg_d->syncpoints = (ogg_syncpoint_t*)realloc(ogg_d->syncpoints,(ogg_d->num_syncpoint+1)*sizeof(ogg_syncpoint_t));
+        if (ogg_d->num_syncpoint > SIZE_MAX / sizeof(ogg_syncpoint_t) - 1) break;
+	ogg_d->syncpoints = realloc_struct(ogg_d->syncpoints,(ogg_d->num_syncpoint+1), sizeof(ogg_syncpoint_t));
 	ogg_d->syncpoints[ogg_d->num_syncpoint].granulepos = op.granulepos;
 	ogg_d->syncpoints[ogg_d->num_syncpoint].page_pos = (ogg_page_continued(page) && p == 0) ? last_pos : pos;
 	ogg_d->num_syncpoint++;