[vlc-devel] [PATCH 1/2] httplive: fix Read func. (when caller skips data)
fyhuel at viotech.net
Sat Dec 31 19:18:20 CET 2011
2011/12/31 Frédéric Yhuel <fyhuel at viotech.net>:
> This patch is indeed wrong...
Jean-Paul, I reacted a tad too fast... Actually I think that patch is good.
> Le 31 déc. 2011 à 10:32, Jean-Paul Saman <jpsaman at videolan.org> a écrit :
>> This patch is wrong p_read should have been checked earlier.
>> On Fri, Dec 30, 2011 at 11:18 AM, <fyhuel at viotech.net> wrote:
>>> From: Frédéric Yhuel <fyhuel at viotech.net>
>>> modules/stream_filter/httplive.c | 12 ++----------
>>> 1 files changed, 2 insertions(+), 10 deletions(-)
>>> diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
>>> index 4d60d8a..58dc1db 100644
>>> --- a/modules/stream_filter/httplive.c
>>> +++ b/modules/stream_filter/httplive.c
>>> @@ -1912,7 +1912,8 @@ static ssize_t hls_Read(stream_t *s, uint8_t *p_read, unsigned int i_read)
>>> if (len > 0)
>>> - memcpy(p_read + copied, segment->data->p_buffer, len);
>>> + if( p_read ) /* otherwise caller skips data */
>>> + memcpy(p_read + copied, segment->data->p_buffer, len);
>> Below you update the segment data buffer while p_read is NULL, which
>> is the wrong thing to do.
So what is the right thing to do? Do you agree that currently data is
read (instead of being skipped) when p_read is null?
Happy new year!
More information about the vlc-devel