[FFmpeg-devel] [PATCH]lavf/matroskaenc: Do not allow -reserve_index_space 1

Nicolas George george at nsup.org
Sun Feb 11 21:57:14 EET 2018


Carl Eugen Hoyos (2018-02-11):
> 2018-02-11 20:23 GMT+01:00 Nicolas George <george at nsup.org>:
> > Carl Eugen Hoyos (2018-02-11):
> >> Attached patch fixes an assertion failure with the following command line:
> >> $ ffmpeg -f lavfi -i testsrc -reserve_index_space 1 out.mkv
> 
> > Reading the code, it is pretty obvious that 0 is a valid value and
> > forbidding it would be bad.
> 
> It is still the used default value...
> 
> Uglier alternative attached.
> 
> Carl Eugen

> From 6a08d7cb89294b81e87dac93bbf58627e5d37cec Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg at gmail.com>
> Date: Sun, 11 Feb 2018 20:41:32 +0100
> Subject: [PATCH] lavf/matroskaenc: Force the minimum value for
>  -reserve_index_space to 2.
> 
> Fixes an assertion failure:
> Assertion size >= 2 failed at libavformat/matroskaenc.c:298
> ---
>  libavformat/matroskaenc.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index f22c2ab..5950b4d 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -2001,6 +2001,8 @@ static int mkv_write_header(AVFormatContext *s)
>      }
>      if ((pb->seekable & AVIO_SEEKABLE_NORMAL) && mkv->reserve_cues_space) {
>          mkv->cues_pos = avio_tell(pb);

> +        if (mkv->reserve_cues_space == 1)
> +            mkv->reserve_cues_space++;
>          put_ebml_void(pb, mkv->reserve_cues_space);

I would have written it:

        put_ebml_void(pb, FFMAX(2, mkv->reserve_cues_space));

That is more or less equivalent to this patch.

But I do not maintain that file, and I do not know the actual meaning of
these fields any more than you.


>      }
>  

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180211/3fefd69f/attachment.sig>


More information about the ffmpeg-devel mailing list