aboutsummaryrefslogtreecommitdiffstats
path: root/src/xfaces.c
diff options
context:
space:
mode:
authorPaul Eggert2011-07-27 17:48:01 -0700
committerPaul Eggert2011-07-27 17:48:01 -0700
commit044c22e545acef592ed95e4e3bb9f8aeff67291a (patch)
tree167a4c706b62b12ea979bdf6ad47e70b66bb0394 /src/xfaces.c
parentdbf38e02c9ade4979418f24a99962cfef170b957 (diff)
parent8265d3bb30544e58683fc16e23f9908f3d5d0abc (diff)
downloademacs-044c22e545acef592ed95e4e3bb9f8aeff67291a.tar.gz
emacs-044c22e545acef592ed95e4e3bb9f8aeff67291a.zip
Merge: Integer signedness and overflow and related fixes.
Fixes: debbugs:9079
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 }