[MPlayer-cvslog] r25481 - trunk/stream/asf_streaming.c

reimar subversion at mplayerhq.hu
Fri Dec 21 12:34:05 CET 2007


Author: reimar
Date: Fri Dec 21 12:34:04 2007
New Revision: 25481

Log:
100l, buffer bound checks work better when done _before_ access.


Modified:
   trunk/stream/asf_streaming.c

Modified: trunk/stream/asf_streaming.c
==============================================================================
--- trunk/stream/asf_streaming.c	(original)
+++ trunk/stream/asf_streaming.c	Fri Dec 21 12:34:04 2007
@@ -310,21 +310,20 @@ static int asf_streaming_parse_header(in
 	char *end = &buffer[size];
 	
 	mp_msg(MSGT_NETWORK, MSGL_V, "Stream bitrate properties object\n");
+		if (ptr + 2 > end) goto len_err_out;
 		stream_count = AV_RL16(ptr);
 		ptr += 2;
-		if (ptr > end) goto len_err_out;
 		mp_msg(MSGT_NETWORK, MSGL_V, " stream count=[0x%x][%u]\n",
 		        stream_count, stream_count );
 		for( i=0 ; i<stream_count ; i++ ) {
 			uint32_t rate;
 			int id;
 			int j;
+			if (ptr + 6 > end) goto len_err_out;
 			id = AV_RL16(ptr);
 			ptr += 2;
-			if (ptr > end) goto len_err_out;
 			rate = AV_RL32(ptr);
 			ptr += 4;
-			if (ptr > end) goto len_err_out;
 			mp_msg(MSGT_NETWORK, MSGL_V,
                                 "  stream id=[0x%x][%u]\n", id, id);
 			mp_msg(MSGT_NETWORK, MSGL_V,



More information about the MPlayer-cvslog mailing list