mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 09:47:34 +00:00
Everywhere: Use OOM-safe ByteBuffer APIs where possible
If we can easily communicate failure, let's avoid asserting and report failure instead.
This commit is contained in:
parent
6606993432
commit
3a9f00c59b
22 changed files with 135 additions and 67 deletions
|
@ -122,7 +122,8 @@ private:
|
|||
{
|
||||
if (!m_condition()) {
|
||||
write_to_buffer:;
|
||||
m_buffer.append(bytes.data(), bytes.size());
|
||||
if (!m_buffer.try_append(bytes.data(), bytes.size()))
|
||||
return 0;
|
||||
return bytes.size();
|
||||
}
|
||||
|
||||
|
|
|
@ -165,8 +165,9 @@ static void tls(const char* message, size_t len)
|
|||
g_loop.quit(0);
|
||||
};
|
||||
}
|
||||
write.append(message, len);
|
||||
write.append("\r\n", 2);
|
||||
auto ok = write.try_append(message, len);
|
||||
ok = ok && write.try_append("\r\n", 2);
|
||||
VERIFY(ok);
|
||||
}
|
||||
|
||||
static void aes_cbc(const char* message, size_t len)
|
||||
|
@ -2037,7 +2038,10 @@ static void tls_test_client_hello()
|
|||
loop.quit(1);
|
||||
} else {
|
||||
// print_buffer(data.value(), 16);
|
||||
contents.append(data.value().data(), data.value().size());
|
||||
if (!contents.try_append(data.value().data(), data.value().size())) {
|
||||
FAIL(Allocation failed);
|
||||
loop.quit(1);
|
||||
}
|
||||
}
|
||||
};
|
||||
tls->on_tls_finished = [&] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue