bug in modules/demux/live555.cpp
Posted: 11 Jul 2009 04:37
Hi,
I think there is a bug (or typo) in modules/demux/live555.cpp, around line 342, the code
i_sdp += i_read;
if( i_read < i_sdp_max - i_sdp - 1 )
{
p_sdp[i_sdp] = '\0';
break;
}
should be
i_sdp += i_read;
if( 0 < i_sdp_max - i_sdp - 1 )
{
p_sdp[i_sdp] = '\0';
break;
}
Because i_sdp_max - i_sdp -1 is the amount of buffer left, if this amount is greater than 0, it means everything is read into memory. Otherwise we need to increase the buffer and read some more.
The old code works only when the sdp file is small, if the sdp file is bigger than i_sdp_max/2 (initial value is 500) bytes.
I think there is a bug (or typo) in modules/demux/live555.cpp, around line 342, the code
i_sdp += i_read;
if( i_read < i_sdp_max - i_sdp - 1 )
{
p_sdp[i_sdp] = '\0';
break;
}
should be
i_sdp += i_read;
if( 0 < i_sdp_max - i_sdp - 1 )
{
p_sdp[i_sdp] = '\0';
break;
}
Because i_sdp_max - i_sdp -1 is the amount of buffer left, if this amount is greater than 0, it means everything is read into memory. Otherwise we need to increase the buffer and read some more.
The old code works only when the sdp file is small, if the sdp file is bigger than i_sdp_max/2 (initial value is 500) bytes.