mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe
This commit is contained in:
parent
3a9f00c59b
commit
97e97bccab
Notes:
sideshowbarker
2024-07-18 04:39:40 +09:00
Author: https://github.com/alimpfard
Commit: 97e97bccab
Pull-request: https://github.com/SerenityOS/serenity/pull/9832
Reviewed-by: https://github.com/IdanHo
105 changed files with 629 additions and 290 deletions
|
@ -262,7 +262,10 @@ bool Parser::initialize_hint_tables()
|
|||
auto overflow_size = overflow_hint_stream->bytes().size();
|
||||
auto total_size = primary_size + overflow_size;
|
||||
|
||||
possible_merged_stream_buffer = ByteBuffer::create_uninitialized(total_size);
|
||||
auto buffer_result = ByteBuffer::create_uninitialized(total_size);
|
||||
if (!buffer_result.has_value())
|
||||
return false;
|
||||
possible_merged_stream_buffer = buffer_result.release_value();
|
||||
auto ok = possible_merged_stream_buffer.try_append(primary_hint_stream->bytes());
|
||||
ok = ok && possible_merged_stream_buffer.try_append(overflow_hint_stream->bytes());
|
||||
if (!ok)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue