image: check image width and height

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-11-09 15:54:21 +01:00
parent 7108e5cb20
commit 5f0e651ede
1 changed files with 4 additions and 0 deletions

View File

@ -176,6 +176,10 @@ luaA_image_new(lua_State *L)
{
int width = luaL_checknumber(L, 3);
int height = luaL_checknumber(L, 4);
if(width <= 0 || height <= 0)
luaL_error(L, "request image has invalid size");
Imlib_Image imimage = imlib_create_image(width, height);
image_t *image = p_new(image_t, 1);
image->image = imimage;