forked from boostorg/beast
Fix UB in websocket read tests
An object returned from a function is not guaranteed not to be copied in C++14 or earlier, using `initializer_list` removes the reliance on RVO to work. Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
3 files changed
+10
-45
No files matched your search
@@ -133,7 +133,7 @@ public:
|
||||
[&](ws_type_t<deflateSupported>& ws)
|
||||
{
|
||||
put(ws.next_layer().buffer(), cbuf(
|
||||
0x89, 0x00));
|
||||
{0x89, 0x00}));
|
||||
bool invoked = false;
|
||||
ws.control_callback(
|
||||
[&](frame_type kind, string_view)
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
[&](ws_type_t<deflateSupported>& ws)
|
||||
{
|
||||
put(ws.next_layer().buffer(), cbuf(
|
||||
0x88, 0x00));
|
||||
{0x88, 0x00}));
|
||||
bool invoked = false;
|
||||
ws.control_callback(
|
||||
[&](frame_type kind, string_view)
|
||||
@@ -313,7 +313,7 @@ public:
|
||||
[&](ws_type_t<deflateSupported>& ws)
|
||||
{
|
||||
w.write_raw(ws, cbuf(
|
||||
0x8f, 0x80, 0xff, 0xff, 0xff, 0xff));
|
||||
{0x8f, 0x80, 0xff, 0xff, 0xff, 0xff}));
|
||||
doReadTest(w, ws, close_code::protocol_error);
|
||||
});
|
||||
|
||||
@@ -322,7 +322,7 @@ public:
|
||||
[&](ws_type_t<deflateSupported>& ws)
|
||||
{
|
||||
put(ws.next_layer().buffer(), cbuf(
|
||||
0x88, 0x02, 0x03, 0xed));
|
||||
{0x88, 0x02, 0x03, 0xed}));
|
||||
doFailTest(w, ws, error::bad_close_code);
|
||||
});
|
||||
|
||||
@@ -332,8 +332,8 @@ public:
|
||||
{
|
||||
w.write_some(ws, false, sbuf("*"));
|
||||
w.write_raw(ws, cbuf(
|
||||
0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff));
|
||||
{0x80, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}));
|
||||
doReadTest(w, ws, close_code::too_big);
|
||||
});
|
||||
|
||||
@@ -351,7 +351,7 @@ public:
|
||||
[&](ws_type_t<deflateSupported>& ws)
|
||||
{
|
||||
put(ws.next_layer().buffer(), cbuf(
|
||||
0x81, 0x06, 0x03, 0xea, 0xf0, 0x28, 0x8c, 0xbc));
|
||||
{0x81, 0x06, 0x03, 0xea, 0xf0, 0x28, 0x8c, 0xbc}));
|
||||
doFailTest(w, ws, error::bad_frame_payload);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user