summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-01-04 02:21:23 +0000
committerPo Lu <luangruo@yahoo.com>2022-01-04 02:21:23 +0000
commitcd7e7834ba5d40e3181054f02693f64ace6fd6aa (patch)
tree9b2728327dd5aae7895f25ca6f00fe917aba6315
parenta89bc0fe9ca81421a592171d10287ae69fd5910b (diff)
downloademacs-cd7e7834ba5d40e3181054f02693f64ace6fd6aa.tar.gz
emacs-cd7e7834ba5d40e3181054f02693f64ace6fd6aa.tar.bz2
emacs-cd7e7834ba5d40e3181054f02693f64ace6fd6aa.zip
Fix Haiku bitmap sanity checks
* src/haikufns.c (haiku_get_pixel, haiku_put_pixel): Fix sanity checking of coordinate values.
-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)
BBitmap_dimensions (bitmap, &left, &top, &right, &bottom,
&bytes_per_row, &mono_p);
- if (x < left || x > right || y < top || y > bottom)
+ if (x < 0 || x > right - left || y < 0 || y > bottom - top)
emacs_abort ();
if (!mono_p)
@@ -1263,7 +1263,7 @@ haiku_put_pixel (haiku bitmap, int x, int y, unsigned long pixel)
BBitmap_dimensions (bitmap, &left, &top, &right, &bottom,
&bytes_per_row, &mono_p);
- if (x < left || x > right || y < top || y > bottom)
+ if (x < 0 || x > right - left || y < 0 || y > bottom - top)
emacs_abort ();
if (mono_p)