mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Appending 0 bytes to a ByteBuffer should be a no-op (#1699)
- inserting an empty string into LibLine Editor triggered an assertion trying to grow a ByteBuffer by 0 bytes.
This commit is contained in:
parent
38dfd04633
commit
a9779e12ea
Notes:
sideshowbarker
2024-07-19 07:48:45 +09:00
Author: https://github.com/predmond Commit: https://github.com/SerenityOS/serenity/commit/a9779e12ea6 Pull-request: https://github.com/SerenityOS/serenity/pull/1699
1 changed files with 3 additions and 0 deletions
|
@ -211,6 +211,9 @@ public:
|
|||
|
||||
void append(const void* data, size_t data_size)
|
||||
{
|
||||
if (data_size == 0)
|
||||
return;
|
||||
ASSERT(data != nullptr);
|
||||
int old_size = size();
|
||||
grow(size() + data_size);
|
||||
__builtin_memcpy(this->data() + old_size, data, data_size);
|
||||
|
|
Loading…
Reference in a new issue