aboutsummaryrefslogtreecommitdiffstats
path: root/src/xfaces.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xfaces.c')
-rw-r--r--src/xfaces.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 32729ce6f8d..52b125b42e6 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -940,11 +940,13 @@ the pixmap. Bits are stored row by row, each row occupies
940 } 940 }
941 } 941 }
942 942
943 if (NATNUMP (width) && NATNUMP (height) && STRINGP (data)) 943 if (STRINGP (data)
944 && INTEGERP (width) && 0 < XINT (width)
945 && INTEGERP (height) && 0 < XINT (height))
944 { 946 {
945 int bytes_per_row = ((XFASTINT (width) + BITS_PER_CHAR - 1) 947 EMACS_INT bytes_per_row = ((XINT (width) + BITS_PER_CHAR - 1)
946 / BITS_PER_CHAR); 948 / BITS_PER_CHAR);
947 if (SBYTES (data) >= bytes_per_row * XINT (height)) 949 if (XINT (height) <= SBYTES (data) / bytes_per_row)
948 pixmap_p = 1; 950 pixmap_p = 1;
949 } 951 }
950 } 952 }