From 019c4302ad86fd6981e8abc90cd8cb58003b662c Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Sun, 8 Dec 2024 22:36:02 +0100 Subject: Handle tiny files gracefully Lua detection functions used to cause fatal errors on failure to read. We could also reconsider treating detection errors as fatal. --- plugins/vdi.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins/vdi.lua') diff --git a/plugins/vdi.lua b/plugins/vdi.lua index 6124e43..a35c139 100644 --- a/plugins/vdi.lua +++ b/plugins/vdi.lua @@ -16,6 +16,9 @@ -- local detect = function (c) + if #c < 68 then + return false + end c.position = 65 return c:read (4) == "\x7F\x10\xDA\xBE" end -- cgit v1.2.3-70-g09d2