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/pdf.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/pdf.lua') diff --git a/plugins/pdf.lua b/plugins/pdf.lua index d4c7f26..9703f2d 100644 --- a/plugins/pdf.lua +++ b/plugins/pdf.lua @@ -335,7 +335,7 @@ end -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - local detect = function (c) - return c:read (5) == "%PDF-" + return #c >= 5 and c:read (5) == "%PDF-" end local decode_xref_subsection = function (lex, start, count, result) -- cgit v1.2.3-70-g09d2