From 01dd389504620aaea909f2c8f2ec8e753e657bd8 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 25 Jan 2020 16:09:31 +0000 Subject: [PATCH] [Minor] Lua_text: Sanitize span length --- src/lua/lua_text.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c index de8fa9b93..307b2823f 100644 --- a/src/lua/lua_text.c +++ b/src/lua/lua_text.c @@ -460,7 +460,8 @@ lua_text_span (lua_State *L) if (len == -1) { len = t->len - (start - 1); } - else if (len > (t->len - (start - 1))) { + + if (len < 0 || (len > (t->len - (start - 1)))) { return luaL_error (L, "invalid length"); } -- 2.39.5