diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-03 15:39:35 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-03 22:26:51 +0200 |
commit | a5b2f06b0c69221e375edd918a335c68b33d5667 (patch) | |
tree | 468b6afa5928d4cfa332e6714e19f41f10e0a5bf /libavcodec/mjpegdec.h | |
parent | da8c86dd8be244100da226a11b416c20d0c914d6 (diff) | |
download | ffmpeg-a5b2f06b0c69221e375edd918a335c68b33d5667.tar.gz |
avcodec/mjpegdec: Fix leak in case ICC array allocations fail partially
If only one of the two arrays used for the ICC profile could be
successfully allocated, it might be overwritten and leak when
the next ICC entry is encountered. Fix this by using a common struct,
so that one has only one array to allocate.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mjpegdec.h')
-rw-r--r-- | libavcodec/mjpegdec.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/mjpegdec.h b/libavcodec/mjpegdec.h index 732aeab994..0d69d9101b 100644 --- a/libavcodec/mjpegdec.h +++ b/libavcodec/mjpegdec.h @@ -44,6 +44,11 @@ #define MAX_COMPONENTS 4 +typedef struct ICCEntry { + uint8_t *data; + int length; +} ICCEntry; + typedef struct MJpegDecodeContext { AVClass *class; AVCodecContext *avctx; @@ -138,8 +143,7 @@ typedef struct MJpegDecodeContext { const AVPixFmtDescriptor *pix_desc; - uint8_t **iccdata; - int *iccdatalens; + ICCEntry *iccentries; int iccnum; int iccread; |