• Andreas Rheinhardt's avatar
    avformat/matroskaenc: Check allocations implicit in dynamic buffers · 3a822717
    Andreas Rheinhardt authored
    Failures of the allocations that happen under the hood when using dynamic
    buffers are usually completely unchecked and the Matroska muxer is no
    exception to this.
    
    The API has its part in this, because there is no documented way to
    actually check for errors: The return value of both avio_get_dyn_buf()
    as well as avio_close_dyn_buf() is only documented as "the length of
    the byte buffer", so that using this to return errors would be an API
    break.
    
    Therefore this commit uses the only reliable way to check for errors
    with avio_get_dyn_buf(): The AVIOContext's error flag. (This is one of
    the advantages of avio_get_dyn_buf(): By not destroying the AVIOContext
    it is possible to inspect this value.) Checking whether the size or the
    pointer vanishes is not enough as it does not check for truncated output
    (the dynamic buffer API is int based and so has to truncate the buffer
    even when enough memory would be available; it's current actual limit is
    even way below INT_MAX).
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    3a822717
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
fftools Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...