kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2.git/commit/?id=a120e3152a5f9c5f8fadd8862d121cba9bda37be

commit a120e3152a5f9c5f8fadd8862d121cba9bda37be
Author: Kim Woelders <k...@woelders.dk>
Date:   Sat Mar 10 13:05:23 2018 +0100

    Maximum image dimension should be 32767, not 32766
    
    Presumably a glitch from when it last was lowered to "32767".
---
 src/lib/image.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/lib/image.h b/src/lib/image.h
index 3078d38..868cc45 100644
--- a/src/lib/image.h
+++ b/src/lib/image.h
@@ -181,12 +181,14 @@ void                __imlib_SaveImage(ImlibImage * im, 
const char *file,
 #define SET_FLAG(flags, f) ((flags) |= (f))
 #define UNSET_FLAG(flags, f) ((flags) &= (~f))
 
-/* The maximum pixmap dimension is 65535. */
-/* However, for now, use 46340 (46340^2 < 2^31) to avoid buffer overflow 
issues. */
-/* Reduced further to 32767, so that (w * h * sizeof(DATA32)) won't exceed 
ULONG_MAX */
+/* 32767 is the maximum pixmap dimension and ensures that
+ * (w * h * sizeof(DATA32)) won't exceed ULONG_MAX */
 #define X_MAX_DIM 32767
+/* NB! The image dimensions are sometimes used in (dim << 16) like expressions
+ * so great care must be taken if ever it is attempted to change this
+ * condition */
 
 #define IMAGE_DIMENSIONS_OK(w, h) \
-   ( ((w) > 0) && ((h) > 0) && ((w) < X_MAX_DIM) && ((h) < X_MAX_DIM) )
+   ( ((w) > 0) && ((h) > 0) && ((w) <= X_MAX_DIM) && ((h) <= X_MAX_DIM) )
 
 #endif

-- 


Reply via email to