diff options
-rw-r--r-- | html/en/history.html | 2 | ||||
-rw-r--r-- | src/lua5/imlua_process.c | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/html/en/history.html b/html/en/history.html index fad1877..8aac48f 100644 --- a/html/en/history.html +++ b/html/en/history.html @@ -15,6 +15,8 @@ <ul> <li><span style="color: #FF0000">Fixed:</span> AVI format when reading 32 and 16 bpp frames.</li> + <li><span style="color: #FF0000">Fixed:</span> xmin and ymin check in + im.ProcessCrop and in im.ProcessInsert in Lua.</li> </ul> <h3 dir="ltr">Version 3.4.1 (15/Dec/2008)</h3> <ul> diff --git a/src/lua5/imlua_process.c b/src/lua5/imlua_process.c index f4a5ce7..1c77dac 100644 --- a/src/lua5/imlua_process.c +++ b/src/lua5/imlua_process.c @@ -2,7 +2,7 @@ * \brief IM Lua 5 Binding * * See Copyright Notice in im_lib.h - * $Id: imlua_process.c,v 1.2 2008/11/26 17:25:51 scuri Exp $ + * $Id: imlua_process.c,v 1.3 2009/06/24 20:42:29 scuri Exp $ */ #include <memory.h> @@ -625,10 +625,10 @@ static int imluaProcessCrop (lua_State *L) int ymin = luaL_checkint(L, 4); imlua_matchcolor(L, src_image, dst_image); - luaL_argcheck(L, xmin > 0 && xmin < src_image->width, 3, "xmin must be > 0 and < width"); - luaL_argcheck(L, ymin > 0 && ymin < src_image->height, 3, "ymin must be > 0 and < height"); - luaL_argcheck(L, dst_image->width < (src_image->width - xmin), 2, "destiny image size must be smaller than source image width-xmin, height-ymin"); - luaL_argcheck(L, dst_image->height < (src_image->height - ymin), 2, "destiny image size must be smaller than source image width-xmin, height-ymin"); + luaL_argcheck(L, xmin >= 0 && xmin < src_image->width, 3, "xmin must be >= 0 and < width"); + luaL_argcheck(L, ymin >= 0 && ymin < src_image->height, 3, "ymin must be >= 0 and < height"); + luaL_argcheck(L, dst_image->width <= (src_image->width - xmin), 2, "destiny image size must be smaller than source image width-xmin, height-ymin"); + luaL_argcheck(L, dst_image->height <= (src_image->height - ymin), 2, "destiny image size must be smaller than source image width-xmin, height-ymin"); imProcessCrop(src_image, dst_image, xmin, ymin); return 0; @@ -646,8 +646,8 @@ static int imluaProcessInsert (lua_State *L) int ymin = luaL_checkint(L, 5); imlua_matchcolor(L, src_image, dst_image); - luaL_argcheck(L, xmin > 0 && xmin < src_image->width, 3, "xmin must be > 0 and < width"); - luaL_argcheck(L, ymin > 0 && ymin < src_image->height, 3, "ymin must be > 0 and < height"); + luaL_argcheck(L, xmin >= 0 && xmin < src_image->width, 3, "xmin must be >= 0 and < width"); + luaL_argcheck(L, ymin >= 0 && ymin < src_image->height, 3, "ymin must be >= 0 and < height"); imProcessInsert(src_image, region_image, dst_image, xmin, ymin); return 0; |