]> git.sesse.net Git - ffmpeg/commit
avcodec/jpeglsdec: Don't presume the context to contain a JLSState
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Tue, 20 Apr 2021 16:18:36 +0000 (18:18 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Tue, 20 Apr 2021 19:19:29 +0000 (21:19 +0200)
commit718e03e5f297564b828730dfc012fa3f6fbf576b
tree27aec99b25704a12c688ecf8bbfc059202cfb0a7
parentf40e9b13554d88cbdd6cd2b4a3da2cbea9590f5d
avcodec/jpeglsdec: Don't presume the context to contain a JLSState

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@niedermayer.cc>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
libavcodec/jpeglsdec.c
libavcodec/mjpegdec.c
libavcodec/mjpegdec.h