aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mxpegdec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-04-21 13:33:33 -0300
committerJames Almer <jamrial@gmail.com>2021-04-25 10:57:29 -0300
commitc8197f73e684b0edc450f3dc2b2b4b3fb9dedd0d (patch)
tree0dd3921c76bcbe30e1862591e0cdcdde11326cf5 /libavcodec/mxpegdec.c
parentbc2726969400e1e57d25d1042f860eb2cbdf7465 (diff)
downloadffmpeg-c8197f73e684b0edc450f3dc2b2b4b3fb9dedd0d.tar.gz
avcodec/mjpegdec: postpone calling ff_get_buffer() until the SOS marker
With JPEG-LS PAL8 samples, the JPEG-LS extension parameters signaled with the LSE marker show up after SOF but before SOS. For those, the pixel format chosen by get_format() in SOF is GRAY8, and then replaced by PAL8 in LSE. This has not been an issue given both pixel formats allocate the second data plane for the palette, but after the upcoming soname bump, GRAY8 will no longer do that. This will result in segfauls when ff_jpegls_decode_lse() attempts to write the palette on a buffer originally allocated as a GRAY8 one. Work around this by calling ff_get_buffer() after the actual pixel format is known. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/mxpegdec.c')
-rw-r--r--libavcodec/mxpegdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/mxpegdec.c b/libavcodec/mxpegdec.c
index 763ce5871d..617da52cf0 100644
--- a/libavcodec/mxpegdec.c
+++ b/libavcodec/mxpegdec.c
@@ -197,7 +197,7 @@ static int mxpeg_decode_frame(AVCodecContext *avctx,
buf_end = buf + buf_size;
jpg->got_picture = 0;
s->got_mxm_bitmask = 0;
- s->got_sof_data = !!s->got_sof_data;
+ jpg->seen_sof = s->got_sof_data = !!s->got_sof_data;
while (buf_ptr < buf_end) {
start_code = ff_mjpeg_find_marker(jpg, &buf_ptr, buf_end,
&unescaped_buf_ptr, &unescaped_buf_size);