diff options
author | Kim Woelders <kim@woelders.dk> | 2018-03-10 13:05:23 +0100 |
---|---|---|
committer | Kim Woelders <kim@woelders.dk> | 2018-03-10 20:19:55 +0100 |
commit | a120e3152a5f9c5f8fadd8862d121cba9bda37be (patch) | |
tree | 2f47f389310e9f44b77a242752c64b70eed65e4d | |
parent | 7dc59c88f892764ee2af57c586525598c87f10c4 (diff) | |
download | imlib2-a120e3152a5f9c5f8fadd8862d121cba9bda37be.tar.gz |
Maximum image dimension should be 32767, not 32766
Presumably a glitch from when it last was lowered to "32767".
-rw-r--r-- | src/lib/image.h | 10 |
1 files 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 |