[FFmpeg-devel] [PATCH] libavformat/mov:the "stco" box parse no need return eof.

Michael Niedermayer michael at niedermayer.cc
Mon Nov 20 03:15:32 EET 2017

On Sun, Nov 19, 2017 at 10:00:29PM +0800, tiejun.peng wrote:
> if return eof, will cause to play the whole mp4 file fail.
> For example, currently the whole file will play fail
> when a few bytes missed in the "stco" box
> and the "stco" box is the last box of MP4 file,
> Actually the almost media frames can play success at most time.
> A few words missed in "stco" box and the other box data is full
> will not cause the whole mp4 file fail.
> Signed-off-by: tiejun.peng <tiejun.peng at foxmail.com>
> ---
>  libavformat/mov.c | 3 ---
>  1 file changed, 3 deletions(-)
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 5c9f926..78b7bf7 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -1989,9 +1989,6 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>      sc->chunk_count = i;
> -    if (pb->eof_reached)
> -        return AVERROR_EOF;

The code should not silently accept a truncated stco as undamaged.
That way the user would have no way to know that the file is truncated

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171120/7dfacd13/attachment.sig>

More information about the ffmpeg-devel mailing list