diff mbox

[FFmpeg-devel] lavf/avidec: Be more verbose when ignoring very large tag size

Message ID 201610180042.18646.cehoyos@ag.or.at
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Oct. 17, 2016, 10:42 p.m. UTC
Hi!

Attached patch prints the tag and the tag size when ignoring the size.

Please comment, Carl Eugen
From e99dc274b7b4b4b5ef502ddb0a8245c1f47c2ece Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Tue, 18 Oct 2016 00:37:06 +0200
Subject: [PATCH] lavf/avidec: Be more verbose when ignoring very large tag
 size.

---
 libavformat/avidec.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Oct. 17, 2016, 11:44 p.m. UTC | #1
On Tue, Oct 18, 2016 at 12:42:18AM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch prints the tag and the tag size when ignoring the size.
> 
> Please comment, Carl Eugen

>  avidec.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 5e698290127169160243ccf1f06fe9c443c41b6c  0001-lavf-avidec-Be-more-verbose-when-ignoring-very-large.patch
> From e99dc274b7b4b4b5ef502ddb0a8245c1f47c2ece Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
> Date: Tue, 18 Oct 2016 00:37:06 +0200
> Subject: [PATCH] lavf/avidec: Be more verbose when ignoring very large tag
>  size.
> 
> ---
>  libavformat/avidec.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
> index b291625..2fcb0ee 100644
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -986,7 +986,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
>              if (size > 1000000) {
>                  av_log(s, AV_LOG_ERROR,
>                         "Something went wrong during header parsing, "
> -                       "I will ignore it and try to continue anyway.\n");
> +                       "tag %c%c%c%c has size %u, "
> +                       "I will ignore it and try to continue anyway.\n",
> +                       tag & 0xff, tag >> 8 & 0xff, tag >> 16 & 0xff, tag >> 24 & 0xff,
> +                       size);

the last & 0xff is redundant

LGTM otherwise

[...]
Clément Bœsch Oct. 18, 2016, 6:11 a.m. UTC | #2
On Tue, Oct 18, 2016 at 12:42:18AM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch prints the tag and the tag size when ignoring the size.
> 
> Please comment, Carl Eugen

> From e99dc274b7b4b4b5ef502ddb0a8245c1f47c2ece Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
> Date: Tue, 18 Oct 2016 00:37:06 +0200
> Subject: [PATCH] lavf/avidec: Be more verbose when ignoring very large tag
>  size.
> 
> ---
>  libavformat/avidec.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
> index b291625..2fcb0ee 100644
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -986,7 +986,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
>              if (size > 1000000) {
>                  av_log(s, AV_LOG_ERROR,
>                         "Something went wrong during header parsing, "
> -                       "I will ignore it and try to continue anyway.\n");
> +                       "tag %c%c%c%c has size %u, "
> +                       "I will ignore it and try to continue anyway.\n",
> +                       tag & 0xff, tag >> 8 & 0xff, tag >> 16 & 0xff, tag >> 24 & 0xff,
> +                       size);

please use av_get_codec_tag_string() if the tag can be anything, it will
prevent printing special characters.
Carl Eugen Hoyos Oct. 18, 2016, 1 p.m. UTC | #3
2016-10-18 8:11 GMT+02:00 Clément Bœsch <u@pkh.me>:
> On Tue, Oct 18, 2016 at 12:42:18AM +0200, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> Attached patch prints the tag and the tag size when ignoring the size.
>>
>> Please comment, Carl Eugen
>
>> From e99dc274b7b4b4b5ef502ddb0a8245c1f47c2ece Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
>> Date: Tue, 18 Oct 2016 00:37:06 +0200
>> Subject: [PATCH] lavf/avidec: Be more verbose when ignoring very large tag
>>  size.
>>
>> ---
>>  libavformat/avidec.c |    5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
>> index b291625..2fcb0ee 100644
>> --- a/libavformat/avidec.c
>> +++ b/libavformat/avidec.c
>> @@ -986,7 +986,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>              if (size > 1000000) {
>>                  av_log(s, AV_LOG_ERROR,
>>                         "Something went wrong during header parsing, "
>> -                       "I will ignore it and try to continue anyway.\n");
>> +                       "tag %c%c%c%c has size %u, "
>> +                       "I will ignore it and try to continue anyway.\n",
>> +                       tag & 0xff, tag >> 8 & 0xff, tag >> 16 & 0xff, tag >> 24 & 0xff,
>> +                       size);
>
> please use av_get_codec_tag_string() if the tag can be anything, it will
> prevent printing special characters.

Applied using av_get_codec_tag().

Thank you, Carl Eugen
diff mbox

Patch

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index b291625..2fcb0ee 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -986,7 +986,10 @@  FF_ENABLE_DEPRECATION_WARNINGS
             if (size > 1000000) {
                 av_log(s, AV_LOG_ERROR,
                        "Something went wrong during header parsing, "
-                       "I will ignore it and try to continue anyway.\n");
+                       "tag %c%c%c%c has size %u, "
+                       "I will ignore it and try to continue anyway.\n",
+                       tag & 0xff, tag >> 8 & 0xff, tag >> 16 & 0xff, tag >> 24 & 0xff,
+                       size);
                 if (s->error_recognition & AV_EF_EXPLODE)
                     goto fail;
                 avi->movi_list = avio_tell(pb) - 4;