Fix Haiku bitmap sanity checks

* src/haikufns.c (haiku_get_pixel, haiku_put_pixel): Fix sanity
checking of coordinate values.
This commit is contained in:
Po Lu 2022-01-04 02:21:23 +00:00
parent a89bc0fe9c
commit cd7e7834ba

View file

@ -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)