Skip to content

Fix uninitialized variable #3019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Version 358:
* Removed moved sections from documentation
* Removed superfluous log messages from tests
* Fixed portability issues for building tests in MinGW
* Fixed portability issues for building tests in MinGW
* Fixed `std::is_trivial` deprecation warnings
* Fixed `-Wmaybe-uninitialized` warnings

--------------------------------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions doc/qbk/release_notes.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* [issue 2999] Used `handshake_timeout` for closing handshake during read operations
* [issue 3003] Added missing `cstdint` header to `detail/cpu_info.hpp`
* [issue 3016] Fixed `std::is_trivial` deprecation warnings
* [issue 3019] Fixed `-Wmaybe-uninitialized` warnings

[*Improvements]

Expand Down
2 changes: 1 addition & 1 deletion include/boost/beast/websocket/detail/frame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ read_close(
return;
}

std::uint16_t code_be;
std::uint16_t code_be = {};
cr.reason.resize(n - 2);
std::array<net::mutable_buffer, 2> out_bufs{{
net::mutable_buffer(&code_be, sizeof(code_be)),
Expand Down
7 changes: 3 additions & 4 deletions include/boost/beast/websocket/impl/stream_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,8 +825,7 @@ parse_fh(
{
case 126:
{

std::uint16_t len_be;
std::uint16_t len_be = {};
BOOST_ASSERT(buffer_bytes(cb) >= sizeof(len_be));
cb.consume(net::buffer_copy(
net::mutable_buffer(&len_be, sizeof(len_be)), cb));
Expand All @@ -841,7 +840,7 @@ parse_fh(
}
case 127:
{
std::uint64_t len_be;
std::uint64_t len_be = {};
BOOST_ASSERT(buffer_bytes(cb) >= sizeof(len_be));
cb.consume(net::buffer_copy(
net::mutable_buffer(&len_be, sizeof(len_be)), cb));
Expand All @@ -857,7 +856,7 @@ parse_fh(
}
if(fh.mask)
{
std::uint32_t key_le;
std::uint32_t key_le = {};
BOOST_ASSERT(buffer_bytes(cb) >= sizeof(key_le));
cb.consume(net::buffer_copy(
net::mutable_buffer(&key_le, sizeof(key_le)), cb));
Expand Down