mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=380494, allow zero-width/height surfaces (crash moz_cairo_win32_surface_get_image etc.), r+sr=roc
This commit is contained in:
parent
66dd634a48
commit
46ddf124bb
@ -273,18 +273,24 @@ gfxASurface::CairoStatus()
|
||||
PRBool
|
||||
gfxASurface::CheckSurfaceSize(const gfxIntSize& sz, PRInt32 limit)
|
||||
{
|
||||
if (sz.width <= 0 || sz.height <= 0)
|
||||
if (sz.width < 0 || sz.height < 0) {
|
||||
NS_ERROR("Surface width or height < 0!");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// check to make sure we don't overflow a 32-bit
|
||||
PRInt32 tmp = sz.width * sz.height;
|
||||
if (tmp / sz.height != sz.width)
|
||||
if (tmp && tmp / sz.height != sz.width) {
|
||||
NS_ERROR("Surface size too large (would overflow)!");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// always assume 4-byte stride
|
||||
tmp = tmp * 4;
|
||||
if (tmp / 4 != sz.width * sz.height)
|
||||
if (tmp && tmp / 4 != sz.width * sz.height) {
|
||||
NS_ERROR("Surface size too large (would overflow)!");
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// reject images with sides bigger than limit
|
||||
if (limit &&
|
||||
|
Loading…
Reference in New Issue
Block a user