[FFmpeg-cvslog] avcodec/xpmdec: Check size before allocation to avoid truncation
Michael Niedermayer
git at videolan.org
Tue Mar 28 00:15:20 EEST 2023
ffmpeg | branch: release/5.0 | Michael Niedermayer <michael at niedermayer.cc> | Thu Jan 12 22:05:07 2023 +0100| [bee5541a4430875a1707fa7fe3aa9d9c9beaad7b] | committer: Michael Niedermayer
avcodec/xpmdec: Check size before allocation to avoid truncation
Fixes:OOM
Fixes:out of array access (no testcase)
Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XPM_fuzzer-6573323838685184
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 95f0f84dae4f040d91f1e60dc5438612c58e8906)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bee5541a4430875a1707fa7fe3aa9d9c9beaad7b
---
libavcodec/xpmdec.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c
index a11926ba28..a2ae71df95 100644
--- a/libavcodec/xpmdec.c
+++ b/libavcodec/xpmdec.c
@@ -355,6 +355,9 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
+ if (size > SIZE_MAX / 4)
+ return AVERROR(ENOMEM);
+
size *= 4;
ptr += mod_strcspn(ptr, ",") + 1;
More information about the ffmpeg-cvslog
mailing list