summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/xpmdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c
index ff1f51dd32..2550afb9d6 100644
--- a/libavcodec/xpmdec.c
+++ b/libavcodec/xpmdec.c
@@ -354,6 +354,9 @@ static int xpm_decode_frame(AVCodecContext *avctx, AVFrame *p,
return AVERROR_INVALIDDATA;
}
+ if (size > SIZE_MAX / 4)
+ return AVERROR(ENOMEM);
+
size *= 4;
ptr += mod_strcspn(ptr, ",") + 1;