From 24054b0a095953c6577d7f89ad4686de71345fea Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 6 May 2021 22:24:00 +0100 Subject: [PATCH] [Minor] Fix check condition --- lualib/lua_magic/heuristics.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua index 66e186906..d977596ca 100644 --- a/lualib/lua_magic/heuristics.lua +++ b/lualib/lua_magic/heuristics.lua @@ -333,7 +333,7 @@ exports.text_part_heuristic = function(part, log_obj, _) local b = bytes[idx] local n8bit = 0 - while b >= 127 and n8bit < remain do + while b >= 127 and idx < remain do -- utf8 part if bit.band(b, 0xe0) == 0xc0 and remain > 1 and bit.band(bytes[idx + 1], 0xc0) == 0x80 then -- 2.39.5