Without this fix, (bitmap-spec-p '(
34359738368 1 "x"))
would wrongly return t on a 64-bit host.
+2011-07-12 Paul Eggert <eggert@cs.ucla.edu>
+
+ * xfaces.c (Fbitmap_spec_p): Fix integer overflow bug.
+ Without this fix, (bitmap-spec-p '(34359738368 1 "x"))
+ would wrongly return t on a 64-bit host.
+
2011-07-11 Paul Eggert <eggert@cs.ucla.edu>
* dispnew.c (init_display): Use *_RANGE_OVERFLOW macros.
}
}
- if (NATNUMP (width) && NATNUMP (height) && STRINGP (data))
+ if (STRINGP (data)
+ && INTEGERP (width) && 0 < XINT (width)
+ && INTEGERP (height) && 0 < XINT (height))
{
- int bytes_per_row = ((XFASTINT (width) + BITS_PER_CHAR - 1)
- / BITS_PER_CHAR);
- if (SBYTES (data) >= bytes_per_row * XINT (height))
+ EMACS_INT bytes_per_row = ((XINT (width) + BITS_PER_CHAR - 1)
+ / BITS_PER_CHAR);
+ if (XINT (height) <= SBYTES (data) / bytes_per_row)
pixmap_p = 1;
}
}