image.argb32(): Check for zero height or width
This makes image.argb32() fail in a better way if it is called with a zero size. Bug found by anrxc and reported a FS#597 and FS#599. Signed-off-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
1c57970dd9
commit
c0661abc61
5
image.c
5
image.c
|
@ -303,6 +303,11 @@ luaA_image_argb32_new(lua_State *L)
|
|||
unsigned int width = luaL_checknumber(L, 1);
|
||||
unsigned int height = luaL_checknumber(L, 2);
|
||||
|
||||
if (width == 0)
|
||||
luaL_error(L, "image.argb32() called with zero width");
|
||||
if (height == 0)
|
||||
luaL_error(L, "image.argb32() called with zero height");
|
||||
|
||||
if(lua_isnil(L, 3))
|
||||
{
|
||||
uint32_t *data = p_new(uint32_t, width * height);
|
||||
|
|
Loading…
Reference in New Issue