mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Bug in CREReader:ZipContentExt().
Even after restoring to the previous version, this function had a slight bug that would cause a crash on valid .zip files (e.g. mupdf-thirdparty.zip in kindlepdfviewer make tree). The reason is because the value of s may be not nil, but the string.match() would return nil and so string.lower() would get nil as an argument and crash. So, we have to guard against this carefully.
This commit is contained in:
@@ -45,7 +45,14 @@ function CREReader:ZipContentExt(fname)
|
||||
if i > 3 then tmp:close(); break; end
|
||||
i = i + 1
|
||||
end
|
||||
return s and string.lower(string.match(s, ".+%.([^.]+)"))
|
||||
if s then
|
||||
local ext = string.match(s, ".+%.([^.]+)")
|
||||
if ext then
|
||||
ext = string.lower(ext)
|
||||
return ext
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- open a CREngine supported file and its settings store
|
||||
|
||||
Reference in New Issue
Block a user