]> git.sesse.net Git - ffmpeg/commit
avformat/matroskaenc: Don't segfault when seekability changes
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 1 May 2020 18:21:45 +0000 (20:21 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 18 May 2020 22:04:04 +0000 (00:04 +0200)
commit8aabcf6c1151b9e50ae5447da6709a72022b9a60
treef3823fadd760f513a0a78d5442543ea59d42f4bf
parent6275a7ec735b2cccaf1ab430d3c777f0ade4b18f
avformat/matroskaenc: Don't segfault when seekability changes

If the Matroska muxer's AVIOContext was unseekable when writing the
header, but is seekable when writing the trailer, the code for writing
the trailer presumes that a dynamic buffer exists and tries to update
its content in order to overwrite data that has already been
preliminarily written when writing the header, yet said buffer doesn't
exist as it has been written finally and not preliminarily when writing
the header (because of the unseekability it was presumed that one won't
be able to update the data anyway).

This commit adds a check for this and also for a similar situation
involving updating extradata with new data from packet side-data.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/matroskaenc.c