aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-01-04 02:21:23 +0000
committerPo Lu2022-01-04 02:21:23 +0000
commitcd7e7834ba5d40e3181054f02693f64ace6fd6aa (patch)
tree9b2728327dd5aae7895f25ca6f00fe917aba6315 /src
parenta89bc0fe9ca81421a592171d10287ae69fd5910b (diff)
downloademacs-cd7e7834ba5d40e3181054f02693f64ace6fd6aa.tar.gz
emacs-cd7e7834ba5d40e3181054f02693f64ace6fd6aa.zip
Fix Haiku bitmap sanity checks
* src/haikufns.c (haiku_get_pixel, haiku_put_pixel): Fix sanity checking of coordinate values.
Diffstat (limited to 'src')
-rw-r--r--src/haikufns.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/haikufns.c b/src/haikufns.c
index 036da7975f8..6cd12f129c6 100644
--- a/src/haikufns.c
+++ b/src/haikufns.c
@@ -1238,7 +1238,7 @@ haiku_get_pixel (haiku bitmap, int x, int y)
1238 BBitmap_dimensions (bitmap, &left, &top, &right, &bottom, 1238 BBitmap_dimensions (bitmap, &left, &top, &right, &bottom,
1239 &bytes_per_row, &mono_p); 1239 &bytes_per_row, &mono_p);
1240 1240
1241 if (x < left || x > right || y < top || y > bottom) 1241 if (x < 0 || x > right - left || y < 0 || y > bottom - top)
1242 emacs_abort (); 1242 emacs_abort ();
1243 1243
1244 if (!mono_p) 1244 if (!mono_p)
@@ -1263,7 +1263,7 @@ haiku_put_pixel (haiku bitmap, int x, int y, unsigned long pixel)
1263 BBitmap_dimensions (bitmap, &left, &top, &right, &bottom, 1263 BBitmap_dimensions (bitmap, &left, &top, &right, &bottom,
1264 &bytes_per_row, &mono_p); 1264 &bytes_per_row, &mono_p);
1265 1265
1266 if (x < left || x > right || y < top || y > bottom) 1266 if (x < 0 || x > right - left || y < 0 || y > bottom - top)
1267 emacs_abort (); 1267 emacs_abort ();
1268 1268
1269 if (mono_p) 1269 if (mono_p)