diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-09-20 12:28:03 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-02-27 07:20:58 +0100 |
commit | 9637dc8ebdb95f1d5cc1507b84e5f8fbba4e5dcf (patch) | |
tree | 428c8fa61f876f449603d1746c8dbf1049633833 /doc/examples/decode_audio.c | |
parent | 5db6f6672f12c5e367e5b5cdf7f3107088f0e216 (diff) | |
download | ffmpeg-9637dc8ebdb95f1d5cc1507b84e5f8fbba4e5dcf.tar.gz |
avformat/swfdec: Reorder allocations/initializations
The earlier code would first attempt to allocate two buffers, then
attempt to allocate an AVIOContext, using one of the new buffers I/O
buffer, then check the allocations. On success, a z_stream that is used
in the AVIOContext's read_packet callback is initialized afterwards.
There are two problems with this: In case the allocation of the I/O
buffer fails avio_alloc_context() will be given a NULL read buffer
with a size > 0. This works right now, but it is fragile. The second
problem is that the z_stream used in the read_packet callback is not
functional when avio_alloc_context() is allocated (it might be that
avio_alloc_context() might already fill the buffer in the future). This
commit fixes both of these problems by reordering the operations.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit 3f04c3037223f5e5417a14674103f3eeabb4887c)
Diffstat (limited to 'doc/examples/decode_audio.c')
0 files changed, 0 insertions, 0 deletions