# HG changeset patch # User rtognimp # Date 1120677616 0 # Node ID f59fdc0d0d14d9508886edab50a85a16e045e95a # Parent 782c636d50c853c07d28d37cae6a9a81450e8d37 Do some sanity checks before writing stream information Patch by Sergio Gelato >Sergio dot Gelato at astro dot su dot se< and some additions by me diff -r 782c636d50c8 -r f59fdc0d0d14 libmpdemux/realrtsp/sdpplin.c --- a/libmpdemux/realrtsp/sdpplin.c Wed Jul 06 18:28:09 2005 +0000 +++ b/libmpdemux/realrtsp/sdpplin.c Wed Jul 06 19:20:16 2005 +0000 @@ -26,10 +26,12 @@ * */ +#include "config.h" #include "rmff.h" #include "rtsp.h" #include "sdpplin.h" #include "xbuffer.h" +#include "mp_msg.h" /* #define LOG @@ -251,7 +253,10 @@ #ifdef LOG printf("got data for stream id %u\n", stream->stream_id); #endif + if (desc->stream && (stream->stream_id >= 0) && (stream->stream_id < desc->stream_count)) desc->stream[stream->stream_id]=stream; + else + mp_msg(MSGT_OPEN, MSGL_ERR, "sdpplin: got 'm=', but 'a=StreamCount' is still unknown. Broken sdp?\n"); continue; } @@ -284,7 +289,7 @@ } if(filter(data,"a=StreamCount:integer;",&buf)) { - desc->stream_count=atoi(buf); + desc->stream_count=(unsigned int)atoi(buf); desc->stream=malloc(sizeof(sdpplin_stream_t*)*desc->stream_count); handled=1; data=nl(data);