aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_text.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-26 16:30:34 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-26 16:30:34 +0000
commitd055682d58ee60a67cb4efcb7448309935fd50db (patch)
tree6829f4932b3addd2f76c645e3ebaf0545aa32e26 /src/lua/lua_text.c
parent843a6e1bcd0bc3a50079ecccf7685f590c678004 (diff)
downloadrspamd-d055682d58ee60a67cb4efcb7448309935fd50db.tar.gz
rspamd-d055682d58ee60a67cb4efcb7448309935fd50db.zip
[Minor] Improve logging
Diffstat (limited to 'src/lua/lua_text.c')
-rw-r--r--src/lua/lua_text.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c
index 09d9b88c1..55dcb8a88 100644
--- a/src/lua/lua_text.c
+++ b/src/lua/lua_text.c
@@ -355,7 +355,7 @@ lua_text_span (lua_State *L)
{
LUA_TRACE_POINT;
struct rspamd_lua_text *t = lua_check_text (L, 1);
- gint start = lua_tointeger (L, 2), len = -1;
+ gint64 start = lua_tointeger (L, 2), len = -1;
if (t && start >= 1 && start <= t->len) {
if (lua_isnumber (L, 3)) {
@@ -372,7 +372,13 @@ lua_text_span (lua_State *L)
lua_new_text (L, t->start + (start - 1), len, FALSE);
}
else {
- return luaL_error (L, "invalid arguments");
+ if (!t) {
+ return luaL_error (L, "invalid arguments, text required");
+ }
+ else {
+ return luaL_error (L, "invalid arguments: start offset %d "
+ "is larger than text len %d", (int)start, (int)t->len);
+ }
}
return 1;