[NUT-devel] [nut]: r145 - in trunk/libnut: demuxer.c priv.h

ods15 subversion at mplayerhq.hu
Sat Sep 23 21:28:07 CEST 2006


Author: ods15
Date: Sat Sep 23 21:28:06 2006
New Revision: 145

Modified:
   trunk/libnut/demuxer.c
   trunk/libnut/priv.h

Log:
out of memory paranoia in index


Modified: trunk/libnut/demuxer.c
==============================================================================
--- trunk/libnut/demuxer.c	(original)
+++ trunk/libnut/demuxer.c	Sat Sep 23 21:28:06 2006
@@ -437,10 +437,13 @@
 	}
 
 	GET_V(tmp, x);
+	ERROR(SIZE_MAX/x < sizeof(syncpoint_t) || SIZE_MAX/x < sizeof(uint64_t) * nut->stream_count, -ERR_OUT_OF_MEM);
+
 	sl->alloc_len = sl->len = x;
 	sl->s = nut->alloc->realloc(sl->s, sl->alloc_len * sizeof(syncpoint_t));
 	sl->pts = nut->alloc->realloc(sl->pts, sl->alloc_len * sizeof(uint64_t) * nut->stream_count);
 	sl->eor = nut->alloc->realloc(sl->eor, sl->alloc_len * sizeof(uint64_t) * nut->stream_count);
+	ERROR(!sl->s || !sl->pts || !sl->eor, -ERR_OUT_OF_MEM);
 
 	for (i = 0; i < sl->len; i++) {
 		GET_V(tmp, sl->s[i].pos);

Modified: trunk/libnut/priv.h
==============================================================================
--- trunk/libnut/priv.h	(original)
+++ trunk/libnut/priv.h	Sat Sep 23 21:28:06 2006
@@ -51,6 +51,7 @@
 	ERR_BAD_STREAM_ORDER,
 	ERR_NOSTREAM_STARTCODE,
 	ERR_BAD_EOF,
+	ERR_OUT_OF_MEM,
 };
 
 typedef struct {



More information about the NUT-devel mailing list