Commit c8907a93 authored by Paul Eggert's avatar Paul Eggert
Browse files

* 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.
parent e9eb6f14
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.
......
......@@ -940,11 +940,13 @@ the pixmap. Bits are stored row by row, each row occupies
}
}
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;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment