diff options
author | Kelvin Zhang <zhangkelvin@google.com> | 2020-09-19 02:51:22 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-09-19 02:51:22 +0200 |
commit | c1d2c15785043f5b45082d005d753e830ce602f0 (patch) | |
tree | f892e9ca467b4f751345a2a3200caf8903a217c9 /updater/target_files.cpp | |
parent | Merge "Merge mainline-release 6664920 to master - DO NOT MERGE" (diff) | |
parent | Check for overflow before allocating memory fore decompression. (diff) | |
download | android_bootable_recovery-c1d2c15785043f5b45082d005d753e830ce602f0.tar android_bootable_recovery-c1d2c15785043f5b45082d005d753e830ce602f0.tar.gz android_bootable_recovery-c1d2c15785043f5b45082d005d753e830ce602f0.tar.bz2 android_bootable_recovery-c1d2c15785043f5b45082d005d753e830ce602f0.tar.lz android_bootable_recovery-c1d2c15785043f5b45082d005d753e830ce602f0.tar.xz android_bootable_recovery-c1d2c15785043f5b45082d005d753e830ce602f0.tar.zst android_bootable_recovery-c1d2c15785043f5b45082d005d753e830ce602f0.zip |
Diffstat (limited to '')
-rw-r--r-- | updater/target_files.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/updater/target_files.cpp b/updater/target_files.cpp index 951923293..207146f52 100644 --- a/updater/target_files.cpp +++ b/updater/target_files.cpp @@ -137,6 +137,13 @@ bool TargetFile::ReadEntryToString(const std::string_view name, std::string* con return true; } + if (entry.uncompressed_length > std::numeric_limits<size_t>::max()) { + LOG(ERROR) << "Failed to extract " << name + << " because's uncompressed size exceeds size of address space. " + << entry.uncompressed_length; + return false; + } + content->resize(entry.uncompressed_length); if (auto extract_err = ExtractToMemory( handle_, &entry, reinterpret_cast<uint8_t*>(&content->at(0)), entry.uncompressed_length); |