Fix uninitalized memory use in deflate_stream

Reference in original zlib:
https://github.com/madler/zlib/pull/393

Resolves: #1586

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
Damian Jarek
2019-04-23 02:24:22 +02:00
parent 16631de5d9
commit 7a388b7da6
3 changed files with 2 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ Version 254:
* Fix data race in test::stream::connect * Fix data race in test::stream::connect
* Fix UB in websocket close tests * Fix UB in websocket close tests
* Fix uninitalized memory use in deflate_stream
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -623,6 +623,7 @@ init()
window_ = reinterpret_cast<Byte*>(buf_.get()); window_ = reinterpret_cast<Byte*>(buf_.get());
prev_ = reinterpret_cast<std::uint16_t*>(buf_.get() + nwindow); prev_ = reinterpret_cast<std::uint16_t*>(buf_.get() + nwindow);
std::memset(prev_, 0, nprev);
head_ = reinterpret_cast<std::uint16_t*>(buf_.get() + nwindow + nprev); head_ = reinterpret_cast<std::uint16_t*>(buf_.get() + nwindow + nprev);
/* We overlay pending_buf_ and d_buf_ + l_buf_. This works /* We overlay pending_buf_ and d_buf_ + l_buf_. This works

View File

@@ -3,11 +3,6 @@
Memcheck:Cond Memcheck:Cond
fun:fill_window fun:fill_window
} }
{
beast_fill_window_no_init
Memcheck:Cond
fun:_ZN5beast4zlib6detail14deflate_stream11fill_windowIvEEvRNS0_8z_paramsE
}
{ {
Ignore OpenSSL malloc Ignore OpenSSL malloc
Memcheck:Leak Memcheck:Leak