mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 02:59:45 +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
Notes:
sideshowbarker
2024-07-18 04:39:44 +09:00
Author: https://github.com/alimpfard
Commit: 3a9f00c59b
Pull-request: https://github.com/SerenityOS/serenity/pull/9832
Reviewed-by: https://github.com/IdanHo
22 changed files with 135 additions and 67 deletions
|
@ -744,7 +744,8 @@ ParseResult<CustomSection> CustomSection::parse(InputStream& stream)
|
|||
auto size = stream.read({ buf, 16 });
|
||||
if (size == 0)
|
||||
break;
|
||||
data_buffer.append(buf, size);
|
||||
if (!data_buffer.try_append(buf, size))
|
||||
return with_eof_check(stream, ParseError::HugeAllocationRequested);
|
||||
}
|
||||
|
||||
return CustomSection(name.release_value(), move(data_buffer));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue