[FFmpeg-devel] lavf/apngdec: Return eof for incomplete files

Submitted by Carl Eugen Hoyos on Nov. 7, 2018, 12:34 a.m.

Details

Message ID CAB0OVGob-VASXuMOoXD=Mvk8qYyt0fF_pvGAPbwB9-cOMTeyzA@mail.gmail.com
State New
Headers show

Commit Message

Carl Eugen Hoyos Nov. 7, 2018, 12:34 a.m.
2018-11-07 1:07 GMT+01:00, Marton Balint <cus@passwd.hu>:
>
>
> On Wed, 7 Nov 2018, Carl Eugen Hoyos wrote:
>
>> Hi!
>>
>> Attached patch silences the console flooding for incomplete apng files
>> and fixes ticket #7536:
>> In-stream tag=[0][0][0][0] (0x00000000) len=0 is not implemented.
>> Update your FFmpeg version...
>>
>> Please comment, Carl Eugen
>>
>
>>+
>>+    if (pb->eof_reached)
>>+        return AVERROR_EOF;
>>+
>
> Why not avio_feof(pb)?

New patch attached.

Please comment, Carl Eugen

Comments

Paul B Mahol Nov. 8, 2018, 12:23 p.m.
On 11/7/18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> 2018-11-07 1:07 GMT+01:00, Marton Balint <cus@passwd.hu>:
>>
>>
>> On Wed, 7 Nov 2018, Carl Eugen Hoyos wrote:
>>
>>> Hi!
>>>
>>> Attached patch silences the console flooding for incomplete apng files
>>> and fixes ticket #7536:
>>> In-stream tag=[0][0][0][0] (0x00000000) len=0 is not implemented.
>>> Update your FFmpeg version...
>>>
>>> Please comment, Carl Eugen
>>>
>>
>>>+
>>>+    if (pb->eof_reached)
>>>+        return AVERROR_EOF;
>>>+
>>
>> Why not avio_feof(pb)?
>
> New patch attached.
>
> Please comment, Carl Eugen
>

Isn't this same patch?
Carl Eugen Hoyos Nov. 8, 2018, 12:30 p.m.
2018-11-08 13:23 GMT+01:00, Paul B Mahol <onemda@gmail.com>:
> On 11/7/18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>> 2018-11-07 1:07 GMT+01:00, Marton Balint <cus@passwd.hu>:
>>>
>>>
>>> On Wed, 7 Nov 2018, Carl Eugen Hoyos wrote:
>>>
>>>> Hi!
>>>>
>>>> Attached patch silences the console flooding for incomplete apng files
>>>> and fixes ticket #7536:
>>>> In-stream tag=[0][0][0][0] (0x00000000) len=0 is not implemented.
>>>> Update your FFmpeg version...
>>>>
>>>> Please comment, Carl Eugen
>>>>
>>>
>>>>+
>>>>+    if (pb->eof_reached)
>>>>+        return AVERROR_EOF;
>>>>+
>>>
>>> Why not avio_feof(pb)?
>>
>> New patch attached.
>>
>> Please comment, Carl Eugen
>>
>
> Isn't this same patch?

Looks different here, the file name is the same though,
is that an issue?

Carl Eugen
Paul B Mahol Nov. 8, 2018, 12:36 p.m.
On 11/8/18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> 2018-11-08 13:23 GMT+01:00, Paul B Mahol <onemda@gmail.com>:
>> On 11/7/18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>>> 2018-11-07 1:07 GMT+01:00, Marton Balint <cus@passwd.hu>:
>>>>
>>>>
>>>> On Wed, 7 Nov 2018, Carl Eugen Hoyos wrote:
>>>>
>>>>> Hi!
>>>>>
>>>>> Attached patch silences the console flooding for incomplete apng files
>>>>> and fixes ticket #7536:
>>>>> In-stream tag=[0][0][0][0] (0x00000000) len=0 is not implemented.
>>>>> Update your FFmpeg version...
>>>>>
>>>>> Please comment, Carl Eugen
>>>>>
>>>>
>>>>>+
>>>>>+    if (pb->eof_reached)
>>>>>+        return AVERROR_EOF;
>>>>>+
>>>>
>>>> Why not avio_feof(pb)?
>>>
>>> New patch attached.
>>>
>>> Please comment, Carl Eugen
>>>
>>
>> Isn't this same patch?
>
> Looks different here, the file name is the same though,
> is that an issue?

Sorry, latest patch is ok.
Carl Eugen Hoyos Nov. 8, 2018, 12:39 p.m.
2018-11-08 13:36 GMT+01:00, Paul B Mahol <onemda@gmail.com>:
> On 11/8/18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>> 2018-11-08 13:23 GMT+01:00, Paul B Mahol <onemda@gmail.com>:
>>> On 11/7/18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>>>> 2018-11-07 1:07 GMT+01:00, Marton Balint <cus@passwd.hu>:
>>>>>
>>>>>
>>>>> On Wed, 7 Nov 2018, Carl Eugen Hoyos wrote:
>>>>>
>>>>>> Hi!
>>>>>>
>>>>>> Attached patch silences the console flooding for incomplete apng files
>>>>>> and fixes ticket #7536:
>>>>>> In-stream tag=[0][0][0][0] (0x00000000) len=0 is not implemented.
>>>>>> Update your FFmpeg version...
>>>>>>
>>>>>> Please comment, Carl Eugen
>>>>>>
>>>>>
>>>>>>+
>>>>>>+    if (pb->eof_reached)
>>>>>>+        return AVERROR_EOF;
>>>>>>+
>>>>>
>>>>> Why not avio_feof(pb)?
>>>>
>>>> New patch attached.
>>>>
>>>> Please comment, Carl Eugen
>>>>
>>>
>>> Isn't this same patch?
>>
>> Looks different here, the file name is the same though,
>> is that an issue?
>
> Sorry, latest patch is ok.

Thank you!

Patch applied, Carl Eugen

Patch hide | download patch | download mbox

From ec289871a5ee8e47c46a5c9afcc7385d673472c8 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Wed, 7 Nov 2018 01:31:18 +0100
Subject: [PATCH] lavf/apngdec: Return EOF for incomplete files.

Fixes ticket #7536.
---
 libavformat/apngdec.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c
index f9a97e5..53cdd45 100644
--- a/libavformat/apngdec.c
+++ b/libavformat/apngdec.c
@@ -342,6 +342,10 @@  static int apng_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     len = avio_rb32(pb);
     tag = avio_rl32(pb);
+
+    if (avio_feof(pb))
+        return AVERROR_EOF;
+
     switch (tag) {
     case MKTAG('f', 'c', 'T', 'L'):
         if (len != 26)
-- 
1.7.10.4