diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-04-28 00:50:00 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-28 09:32:33 +0200 |
commit | 8d419c1915ce9fa69e275502f2dc681d889c251d (patch) | |
tree | 9637b07d7f4b44b0f6482b338f8b684b62089d07 | |
parent | c4d3723087e05fc57fb1d415152c146a51115bea (diff) | |
download | serenity-8d419c1915ce9fa69e275502f2dc681d889c251d.zip |
LibCore: Trim decompressed Gzip output to size
Prior to this commit, we would (re-)allocate the output buffer aligned
to 1024 bytes, but never trim it down to size, which caused
Gzip::decompress to return uninitialised data.
-rw-r--r-- | Libraries/LibCore/Gzip.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Libraries/LibCore/Gzip.cpp b/Libraries/LibCore/Gzip.cpp index 0f1f8581be..9365bddac5 100644 --- a/Libraries/LibCore/Gzip.cpp +++ b/Libraries/LibCore/Gzip.cpp @@ -136,6 +136,7 @@ Optional<ByteBuffer> Gzip::decompress(const ByteBuffer& data) if (puff_ret == 0) { dbg() << "Gzip::decompress: Decompression success."; + destination.trim(destination_len); break; } |