diff options
Diffstat (limited to 'updater/updater.cpp')
-rw-r--r-- | updater/updater.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/updater/updater.cpp b/updater/updater.cpp index 8f4a6ede5..c52673462 100644 --- a/updater/updater.cpp +++ b/updater/updater.cpp @@ -163,14 +163,19 @@ void Updater::ParseAndReportErrorCode(State* state) { bool Updater::ReadEntryToString(ZipArchiveHandle za, const std::string& entry_name, std::string* content) { - ZipEntry entry; + ZipEntry64 entry; int find_err = FindEntry(za, entry_name, &entry); if (find_err != 0) { LOG(ERROR) << "failed to find " << entry_name << " in the package: " << ErrorCodeString(find_err); return false; } - + if (entry.uncompressed_length > std::numeric_limits<size_t>::max()) { + LOG(ERROR) << "Failed to extract " << entry_name + << " because's uncompressed size exceeds size of address space. " + << entry.uncompressed_length; + return false; + } content->resize(entry.uncompressed_length); int extract_err = ExtractToMemory(za, &entry, reinterpret_cast<uint8_t*>(&content->at(0)), entry.uncompressed_length); |