summaryrefslogtreecommitdiff
path: root/src/WrFFrI.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/WrFFrI.c')
-rw-r--r--src/WrFFrI.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/WrFFrI.c b/src/WrFFrI.c
index 41b4c0d..5ef5814 100644
--- a/src/WrFFrI.c
+++ b/src/WrFFrI.c
@@ -248,6 +248,8 @@ WritePixels(file, width, height, cpp, pixels, colors)
unsigned int x, y, h;
h = height - 1;
+ if (cpp != 0 && width >= (SIZE_MAX - 3)/cpp)
+ return XpmNoMemory;
p = buf = (char *) XpmMalloc(width * cpp + 3);
if (!buf)
return (XpmNoMemory);