summaryrefslogtreecommitdiff
path: root/fastboot/fastboot.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-09-15 14:26:17 -0700
committerElliott Hughes <enh@google.com>2020-09-15 14:26:17 -0700
commitb407414fd01eac44eb94d6d95f765c744e1ffa0e (patch)
treedf9f79452cf8875cd39540c77297683d03a4bda5 /fastboot/fastboot.cpp
parent135508168a934f224566d42210b52b61170ad21f (diff)
fastboot: switch to ZipEntry64.
Test: treehugger Change-Id: I17a023f113590e469f69174f7004c4579255c6ed
Diffstat (limited to 'fastboot/fastboot.cpp')
-rw-r--r--fastboot/fastboot.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 3969367b0..0921d72ae 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -527,12 +527,15 @@ static std::vector<char> LoadBootableImage(const std::string& kernel, const std:
static bool UnzipToMemory(ZipArchiveHandle zip, const std::string& entry_name,
std::vector<char>* out) {
- ZipEntry zip_entry;
+ ZipEntry64 zip_entry;
if (FindEntry(zip, entry_name, &zip_entry) != 0) {
fprintf(stderr, "archive does not contain '%s'\n", entry_name.c_str());
return false;
}
+ if (zip_entry.uncompressed_length > std::numeric_limits<size_t>::max()) {
+ die("entry '%s' is too large: %" PRIu64, entry_name.c_str(), zip_entry.uncompressed_length);
+ }
out->resize(zip_entry.uncompressed_length);
fprintf(stderr, "extracting %s (%zu MB) to RAM...\n", entry_name.c_str(),
@@ -638,14 +641,14 @@ static void delete_fbemarker_tmpdir(const std::string& dir) {
static int unzip_to_file(ZipArchiveHandle zip, const char* entry_name) {
unique_fd fd(make_temporary_fd(entry_name));
- ZipEntry zip_entry;
+ ZipEntry64 zip_entry;
if (FindEntry(zip, entry_name, &zip_entry) != 0) {
fprintf(stderr, "archive does not contain '%s'\n", entry_name);
errno = ENOENT;
return -1;
}
- fprintf(stderr, "extracting %s (%" PRIu32 " MB) to disk...", entry_name,
+ fprintf(stderr, "extracting %s (%" PRIu64 " MB) to disk...", entry_name,
zip_entry.uncompressed_length / 1024 / 1024);
double start = now();
int error = ExtractEntryToFile(zip, &zip_entry, fd);