From cd7e7834ba5d40e3181054f02693f64ace6fd6aa Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 4 Jan 2022 02:21:23 +0000 Subject: [PATCH] Fix Haiku bitmap sanity checks * src/haikufns.c (haiku_get_pixel, haiku_put_pixel): Fix sanity checking of coordinate values. --- src/haikufns.c | 4 ++-- 1 file 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) -- 2.39.2