[FFmpeg-devel] [PATCH 2/3] avformat/aviobuf: fix checks in ffio_ensure_seekback

Michael Niedermayer michael at niedermayer.cc
Sat Sep 26 13:14:09 EEST 2020


On Sun, Sep 20, 2020 at 10:52:52AM +0200, Marton Balint wrote:
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  libavformat/aviobuf.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

The commit message is too terse. It is not clear from it what the problem
is that is being fixed and how it is fixed.
Also this feels like it fixes multiple issues so it probably should be spit
unless iam missing some interdependancies

ill also take a look at the "competing" patch, so i dont yet know
how they relate ...


> 
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 9675425349..aa1d6c0830 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -999,9 +999,12 @@ int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
>      int filled = s->buf_end - s->buffer;
>      ptrdiff_t checksum_ptr_offset = s->checksum_ptr ? s->checksum_ptr - s->buffer : -1;
>  
> -    buf_size += s->buf_ptr - s->buffer + max_buffer_size;
> +    if (buf_size <= s->buf_end - s->buf_ptr)
> +        return 0;
> +
> +    buf_size += s->buf_ptr - s->buffer + max_buffer_size - 1;
>  

> -    if (buf_size < filled || s->seekable || !s->read_packet)
> +    if (buf_size <= s->buffer_size || s->seekable || !s->read_packet)
>          return 0;

Did you check that this doesnt interfere with the s->buffer_size reduction
we do when it was larger from probing ?
Its maybe ok, just checking that this was considered

thx


[...]
-- 
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: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200926/59afb9c4/attachment.sig>


More information about the ffmpeg-devel mailing list