[FFmpeg-devel] hls: fix baseurl missing last char

Submitted by Robert Nagy on Dec. 1, 2017, 10:06 a.m.

Details

Message ID CALdTkGH=PX2wfhTwQnToDBVHuKhk70-sgciLi7Vk_u2_pBZ5dg@mail.gmail.com
State New
Headers show

Commit Message

Robert Nagy Dec. 1, 2017, 10:06 a.m.
---
 libavformat/hlsenc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

SEGMENT_TYPE_FMP4)) {
--
2.15.0

Comments

Steven Liu Dec. 1, 2017, 10:28 a.m.
2017-12-01 18:06 GMT+08:00 Robert Nagy <ronag89@gmail.com>:
> ---
>  libavformat/hlsenc.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index cdfbf45823..dc8bf48791 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1921,14 +1921,11 @@ static int hls_write_header(AVFormatContext *s)
>      }
>
>      if (hls->baseurl) {
> -        int baseurl_len;
> -        baseurl_len = strlen(hls->baseurl);
> -        vs->baseurl = av_malloc(baseurl_len);
> +        vs->baseurl = av_strdup(hls->baseurl);
>          if (!vs->baseurl) {
>              ret = AVERROR(ENOMEM);
>              goto fail;
>          }
> -        av_strlcpy(vs->baseurl, hls->baseurl, baseurl_len);
>      }
>
>      if ((hls->flags & HLS_SINGLE_FILE) && (hls->segment_type ==
> SEGMENT_TYPE_FMP4)) {
> --
> 2.15.0


LGTM


Thanks
Michael Niedermayer Dec. 2, 2017, 12:59 a.m.
On Fri, Dec 01, 2017 at 11:06:07AM +0100, Robert Nagy wrote:
> ---
>  libavformat/hlsenc.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index cdfbf45823..dc8bf48791 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1921,14 +1921,11 @@ static int hls_write_header(AVFormatContext *s)
>      }
> 
>      if (hls->baseurl) {
> -        int baseurl_len;
> -        baseurl_len = strlen(hls->baseurl);
> -        vs->baseurl = av_malloc(baseurl_len);
> +        vs->baseurl = av_strdup(hls->baseurl);
>          if (!vs->baseurl) {
>              ret = AVERROR(ENOMEM);
>              goto fail;
>          }
> -        av_strlcpy(vs->baseurl, hls->baseurl, baseurl_len);
>      }
> 
>      if ((hls->flags & HLS_SINGLE_FILE) && (hls->segment_type ==
> SEGMENT_TYPE_FMP4)) {

this looks like a stray linebreak
this wont apply automatically


[...]
Steven Liu Dec. 2, 2017, 2:03 a.m.
2017-12-02 8:59 GMT+08:00 Michael Niedermayer <michael@niedermayer.cc>:
> On Fri, Dec 01, 2017 at 11:06:07AM +0100, Robert Nagy wrote:
>> ---
>>  libavformat/hlsenc.c | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index cdfbf45823..dc8bf48791 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -1921,14 +1921,11 @@ static int hls_write_header(AVFormatContext *s)
>>      }
>>
>>      if (hls->baseurl) {
>> -        int baseurl_len;
>> -        baseurl_len = strlen(hls->baseurl);
>> -        vs->baseurl = av_malloc(baseurl_len);
>> +        vs->baseurl = av_strdup(hls->baseurl);
>>          if (!vs->baseurl) {
>>              ret = AVERROR(ENOMEM);
>>              goto fail;
>>          }
>> -        av_strlcpy(vs->baseurl, hls->baseurl, baseurl_len);
>>      }
>>
>>      if ((hls->flags & HLS_SINGLE_FILE) && (hls->segment_type ==
>> SEGMENT_TYPE_FMP4)) {
>
> this looks like a stray linebreak
> this wont apply automatically

Ok, let me apply it manually.


Thanks
>
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> In a rich man's house there is no place to spit but his face.
> -- Diogenes of Sinope
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Steven Liu Dec. 4, 2017, 4:01 a.m.
2017-12-02 10:03 GMT+08:00 Steven Liu <lingjiujianke@gmail.com>:
> 2017-12-02 8:59 GMT+08:00 Michael Niedermayer <michael@niedermayer.cc>:
>> On Fri, Dec 01, 2017 at 11:06:07AM +0100, Robert Nagy wrote:
>>> ---
>>>  libavformat/hlsenc.c | 5 +----
>>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>>
>>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>>> index cdfbf45823..dc8bf48791 100644
>>> --- a/libavformat/hlsenc.c
>>> +++ b/libavformat/hlsenc.c
>>> @@ -1921,14 +1921,11 @@ static int hls_write_header(AVFormatContext *s)
>>>      }
>>>
>>>      if (hls->baseurl) {
>>> -        int baseurl_len;
>>> -        baseurl_len = strlen(hls->baseurl);
>>> -        vs->baseurl = av_malloc(baseurl_len);
>>> +        vs->baseurl = av_strdup(hls->baseurl);
>>>          if (!vs->baseurl) {
>>>              ret = AVERROR(ENOMEM);
>>>              goto fail;
>>>          }
>>> -        av_strlcpy(vs->baseurl, hls->baseurl, baseurl_len);
>>>      }
>>>
>>>      if ((hls->flags & HLS_SINGLE_FILE) && (hls->segment_type ==
>>> SEGMENT_TYPE_FMP4)) {
>>
>> this looks like a stray linebreak
>> this wont apply automatically
>
> Ok, let me apply it manually.
Pushed


Thanks


Steven
>
>
> Thanks
>>
>>
>> [...]
>> --
>> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> In a rich man's house there is no place to spit but his face.
>> -- Diogenes of Sinope
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>

Patch hide | download patch | download mbox

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index cdfbf45823..dc8bf48791 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1921,14 +1921,11 @@  static int hls_write_header(AVFormatContext *s)
     }

     if (hls->baseurl) {
-        int baseurl_len;
-        baseurl_len = strlen(hls->baseurl);
-        vs->baseurl = av_malloc(baseurl_len);
+        vs->baseurl = av_strdup(hls->baseurl);
         if (!vs->baseurl) {
             ret = AVERROR(ENOMEM);
             goto fail;
         }
-        av_strlcpy(vs->baseurl, hls->baseurl, baseurl_len);
     }

     if ((hls->flags & HLS_SINGLE_FILE) && (hls->segment_type ==