aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpegdec.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-03 15:39:35 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-03 22:26:51 +0200
commita5b2f06b0c69221e375edd918a335c68b33d5667 (patch)
tree468b6afa5928d4cfa332e6714e19f41f10e0a5bf /libavcodec/mjpegdec.h
parentda8c86dd8be244100da226a11b416c20d0c914d6 (diff)
downloadffmpeg-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.h8
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;