aboutsummaryrefslogtreecommitdiff
path: root/plugins/vdi.lua
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-12-08 22:36:02 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-12-08 22:37:12 +0100
commit019c4302ad86fd6981e8abc90cd8cb58003b662c (patch)
treed628782319eda36507fb5f5abcf6225ce9ac631a /plugins/vdi.lua
parent189bf940342ebf23b15c7f2dfd27d8a4692b34fc (diff)
downloadhex-019c4302ad86fd6981e8abc90cd8cb58003b662c.tar.gz
hex-019c4302ad86fd6981e8abc90cd8cb58003b662c.tar.xz
hex-019c4302ad86fd6981e8abc90cd8cb58003b662c.zip
Handle tiny files gracefullyHEADorigin/mastermaster
Lua detection functions used to cause fatal errors on failure to read. We could also reconsider treating detection errors as fatal.
Diffstat (limited to 'plugins/vdi.lua')
-rw-r--r--plugins/vdi.lua3
1 files changed, 3 insertions, 0 deletions
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