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 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;