diff mbox series

[FFmpeg-devel] avformat/concatf: ignore trailing whitespaces

Message ID 20211207120031.6495-1-ffmpeg@gyani.pro
State Accepted
Commit a454dfacd560e40fa5fea796f0d5b437f78e54e4
Headers show
Series [FFmpeg-devel] avformat/concatf: ignore trailing whitespaces | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Gyan Doshi Dec. 7, 2021, noon UTC
The concatf protocol returns an opaque error on open if
concatf list file contains trailing newlines.
---
 libavformat/concat.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

James Almer Dec. 7, 2021, 12:09 p.m. UTC | #1
On 12/7/2021 9:00 AM, Gyan Doshi wrote:
> The concatf protocol returns an opaque error on open if
> concatf list file contains trailing newlines.
> ---
>   libavformat/concat.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/concat.c b/libavformat/concat.c
> index 2560811ff9..faeba2293a 100644
> --- a/libavformat/concat.c
> +++ b/libavformat/concat.c
> @@ -245,6 +245,10 @@ static av_cold int concatf_open(URLContext *h, const char *uri, int flags)
>           char *node_uri;
>           int64_t size;
>           size_t len = i;
> +        int leading_spaces = strspn(cursor, " \n\t\r");
> +
> +        if (!cursor[leading_spaces])
> +            break;
>   
>           node_uri = av_get_token(&cursor, "\r\n");
>           if (!node_uri) {

Seems to work, so LGTM.
Gyan Doshi Dec. 7, 2021, 12:22 p.m. UTC | #2
On 2021-12-07 05:39 pm, James Almer wrote:
>
>
> On 12/7/2021 9:00 AM, Gyan Doshi wrote:
>> The concatf protocol returns an opaque error on open if
>> concatf list file contains trailing newlines.
>> ---
>>   libavformat/concat.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/libavformat/concat.c b/libavformat/concat.c
>> index 2560811ff9..faeba2293a 100644
>> --- a/libavformat/concat.c
>> +++ b/libavformat/concat.c
>> @@ -245,6 +245,10 @@ static av_cold int concatf_open(URLContext *h, 
>> const char *uri, int flags)
>>           char *node_uri;
>>           int64_t size;
>>           size_t len = i;
>> +        int leading_spaces = strspn(cursor, " \n\t\r");
>> +
>> +        if (!cursor[leading_spaces])
>> +            break;
>>             node_uri = av_get_token(&cursor, "\r\n");
>>           if (!node_uri) {
>
> Seems to work, so LGTM.

Thanks.

Pushed as a454dfacd560e40fa5fea796f0d5b437f78e54e4

Gyan
diff mbox series

Patch

diff --git a/libavformat/concat.c b/libavformat/concat.c
index 2560811ff9..faeba2293a 100644
--- a/libavformat/concat.c
+++ b/libavformat/concat.c
@@ -245,6 +245,10 @@  static av_cold int concatf_open(URLContext *h, const char *uri, int flags)
         char *node_uri;
         int64_t size;
         size_t len = i;
+        int leading_spaces = strspn(cursor, " \n\t\r");
+
+        if (!cursor[leading_spaces])
+            break;
 
         node_uri = av_get_token(&cursor, "\r\n");
         if (!node_uri) {