]> git.sesse.net Git - ffmpeg/commit
avcodec/vc1dec: Postpone allocating sprite frame to avoid segfault
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 22 Dec 2020 16:21:48 +0000 (17:21 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 24 Mar 2021 23:02:17 +0000 (00:02 +0100)
commitea70c39deecb64f94fe7ae0ea419cbef1c7f9372
tree808a6293335038242da41a41aa7040ae98169378
parent322be6107a8af96193996dd19af95e7b53465310
avcodec/vc1dec: Postpone allocating sprite frame to avoid segfault

Up until now, the VC-1 decoders allocated an AVFrame for usage with
sprites during vc1_decode_init(); yet said AVFrame can be freed if
(re)initializing the context (which happens ordinarily during decoding)
fails. The AVFrame does not get allocated again lateron in this case,
leading to segfaults.

Fix this by moving the allocation of said frame immediately before it is
used (this also means that said frame won't be allocated at all any more
in case of a regular (i.e. non-image) stream).

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