[FFmpeg-devel] [PATCH] avformat/hlsenc: initialize saveptrs

Liu Steven lq at chinaffmpeg.org
Mon Mar 26 15:34:25 EEST 2018


> 在 2018年3月26日,上午11:49,Jeyapal, Karthick <kjeyapal at akamai.com> 写道:
> 
> 
> 
> On 3/25/18 1:43 PM, Timo Rothenpieler wrote:
>> Am 21.03.2018 um 20:37 schrieb Timo Rothenpieler:
>>> Am 21.03.2018 um 20:33 schrieb Timo Rothenpieler:
>>>> av_strtok calls strspn on a non-NULL *saveptr, so not NULL 
>>>> initializing it is an issue.
>>>> 
>>>> Fixes CID #1428568
>>>> ---
>>>>  libavformat/hlsenc.c | 3 ++-
>>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>> 
>>>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>>>> index b7c6fbde6a..fa17776efe 100644
>>>> --- a/libavformat/hlsenc.c
>>>> +++ b/libavformat/hlsenc.c
>>>> @@ -1873,7 +1873,8 @@ static int 
>>>> parse_cc_stream_mapstring(AVFormatContext *s)
>>>>  {
>>>>      HLSContext *hls = s->priv_data;
>>>>      int nb_ccstreams;
>>>> -    char *p, *q, *saveptr1, *saveptr2, *ccstr, *keyval;
>>>> +    char *p, *q, *ccstr, *keyval;
>>>> +    char *saveptr1 = NULL, *saveptr2 = NULL;
>>>>      const char *val;
>>>>      ClosedCaptionsStream *ccs;
>>> 
>>> Just realized, the more correct approach is probably to check the 
>>> av_strdup below this for ENOMEM. Not sure about the exact semantics 
>>> there, initializing these still seems like a good safety measure.
>>> 
> I agree with you that checking the return value of av_strdup for NULL is a better approach.
> But I am fine with this initialization fix as well.

Pushed


Thanks
Steven



More information about the ffmpeg-devel mailing list