diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2022-09-20 02:45:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-20 02:45:50 +0200 |
| commit | d04e1ca96a705f606d5ba75f3bb915a0ea84571a (patch) | |
| tree | 10182a59bc4c950d828a1bdd3a6521eaccea4ce5 /Source/Core | |
| parent | 3b10bf04ac74bff9ce11e6140ddc552f94eb2b3e (diff) | |
| parent | 7432b6ce9157b18aaeb9d5b03b34d8dfd747eb9a (diff) | |
Merge pull request #11058 from shuffle2/updater-inflate
Updater: Move inflate intermediate buffer to heap and enlarge
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/UpdaterCommon/UpdaterCommon.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/Core/UpdaterCommon/UpdaterCommon.cpp b/Source/Core/UpdaterCommon/UpdaterCommon.cpp index 6bbe5b936a..fb9606ca49 100644 --- a/Source/Core/UpdaterCommon/UpdaterCommon.cpp +++ b/Source/Core/UpdaterCommon/UpdaterCommon.cpp @@ -4,6 +4,7 @@ #include "UpdaterCommon/UpdaterCommon.h" #include <array> +#include <memory> #include <optional> #include <OptionParser.h> @@ -132,16 +133,17 @@ std::optional<std::string> GzipInflate(const std::string& data) inflateInit2(&zstrm, 16 + MAX_WBITS); std::string out; - char buffer[4096]; + const size_t buf_len = 20 * 1024 * 1024; + auto buffer = std::make_unique<char[]>(buf_len); int ret; do { - zstrm.avail_out = sizeof(buffer); - zstrm.next_out = reinterpret_cast<u8*>(buffer); + zstrm.avail_out = buf_len; + zstrm.next_out = reinterpret_cast<u8*>(buffer.get()); ret = inflate(&zstrm, 0); - out.append(buffer, sizeof(buffer) - zstrm.avail_out); + out.append(buffer.get(), buf_len - zstrm.avail_out); } while (ret == Z_OK); inflateEnd(&zstrm); |
