[FFmpeg-devel] [PATCH 37/40] avcodec/ffv1: Fix segfaults on allocation error

Michael Niedermayer michael at niedermayer.cc
Wed Sep 16 21:25:17 EEST 2020


On Mon, Sep 14, 2020 at 07:27:44AM +0200, Andreas Rheinhardt wrote:
> When allocating FFV1 slice contexts fails, ff_ffv1_init_slice_contexts()
> frees everything that it has allocated, yet it does not reset the
> counter for the number of allocated slice contexts. This inconsistent
> state leads to segfaults lateron in ff_ffv1_close(), because said
> function presumes that the slice contexts have been allocated.
> Fix this by making sure that the number of slice contexts on error is
> consistent (namely zero).
> 
> (This issue only affected the FFV1 decoder, because the encoder does not
> clean up after itself on init failure.)
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
>  libavcodec/ffv1.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

LGTM

thx

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200916/21a57a08/attachment.sig>


More information about the ffmpeg-devel mailing list