forked from old/legacy-imlib2
Maximum image dimension should be 32767, not 32766
Presumably a glitch from when it last was lowered to "32767".
This commit is contained in:
parent
7dc59c88f8
commit
a120e3152a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue