Changeset 3f04c303 in ffmpeg

Timestamp:
Sep 23, 2020, 3:09:01 PM (4 years ago)
Author:
Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Branches:
master
Children:
d8ce8e8e
Parents:
28dc0c20
git-author:
Andreas Rheinhardt <andreas.rheinhardt@gmail.com> (09/20/20 10:28:03)
git-committer:
Andreas Rheinhardt <andreas.rheinhardt@gmail.com> (09/23/20 15:09:01)
Message:

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>

(No files)

Note: See TracChangeset for help on using the changeset viewer.