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

Timo Rothenpieler timo at rothenpieler.org
Wed Mar 21 21:37:01 EET 2018


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3994 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180321/1c66069f/attachment.bin>


More information about the ffmpeg-devel mailing list