Fix crash loading some kind of .zip extensions w/filename w/Unicode chars

This commit is contained in:
David Capello 2020-04-17 10:58:47 -03:00
parent 9a06deb0e6
commit c0d4264789
2 changed files with 15 additions and 3 deletions

View File

@ -858,7 +858,15 @@ ExtensionInfo Extensions::getCompressedExtensionInfo(const std::string& zipFn)
ReadArchive in(zipFn);
archive_entry* entry;
while ((entry = in.readEntry()) != nullptr) {
const std::string entryFn = archive_entry_pathname(entry);
const char* entryFnPtr = archive_entry_pathname(entry);
// This can happen, e.g. if the file contains "!" + unicode chars
// (maybe a bug in archive library?)
// TODO try to find the real cause of this on libarchive
if (!entryFnPtr)
continue;
const std::string entryFn = entryFnPtr;
if (base::get_file_name(entryFn) != kPackageJson)
continue;
@ -895,8 +903,12 @@ Extension* Extensions::installCompressedExtension(const std::string& zipFn,
archive_entry* entry;
while ((entry = in.readEntry()) != nullptr) {
const char* entryFnPtr = archive_entry_pathname(entry);
if (!entryFnPtr)
continue;
// Fix the entry filename to write the file in the disk
std::string fn = archive_entry_pathname(entry);
std::string fn = entryFnPtr;
LOG("EXT: Original filename in zip <%s>...\n", fn.c_str());

@ -1 +1 @@
Subproject commit e1309af03a4bcea2f0f0bb1f48530f2b794cc8b2
Subproject commit 1ac8fae3220569877203ae607d20262f71f48360