emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master cd7e7834ba 2/2: Fix Haiku bitmap sanity checks


From: Po Lu
Subject: master cd7e7834ba 2/2: Fix Haiku bitmap sanity checks
Date: Mon, 3 Jan 2022 21:35:45 -0500 (EST)

branch: master
commit cd7e7834ba5d40e3181054f02693f64ace6fd6aa
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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 036da7975f..6cd12f129c 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]