[FFmpeg-devel] [PATCH] avcodec/jpeglsdec: Don't presume the context to contain and JLSState

Michael Niedermayer michael at niedermayer.cc
Tue Apr 20 21:50:10 EEST 2021


On Tue, Apr 20, 2021 at 06:26:49PM +0200, Andreas Rheinhardt wrote:
> Before 9b3c46a081a9f01559082bf7a154fc6be1e06c18 every call to
> ff_jpegls_decode_picture() allocated and freed a JLSState. This commit
> instead put said structure into the context of the JPEG-LS decoder to
> avoid said allocation. But said function can also be called from other
> MJPEG-based decoders and their contexts doesn't contain said structure,
> leading to segfaults. This commit fixes this: The JLSState is now
> allocated on the first call to ff_jpegls_decode_picture() and stored in
> the context.
> 
> Found-by: Michael Niedermayer <michael at niedermayer.cc>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
>  libavcodec/jpeglsdec.c | 15 ++++++++-------
>  libavcodec/mjpegdec.c  |  1 +
>  libavcodec/mjpegdec.h  |  3 +++
>  3 files changed, 12 insertions(+), 7 deletions(-)

LGTM

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- 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/20210420/e53bbc24/attachment.sig>


More information about the ffmpeg-devel mailing list