mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Don't try to deserialize past length of strings
If we serialize a string followed by some other object, the deserialize helper would just happily keep appending bytes to the string until the end of the serialization buffer. Avoid doing that by checking the string length for figuring out when the string actually ends.
This commit is contained in:
parent
842b2a01e6
commit
3a74bd2509
Notes:
sideshowbarker
2024-07-16 21:42:29 +09:00
Author: https://github.com/ADKaster
Commit: 3a74bd2509
Pull-request: https://github.com/SerenityOS/serenity/pull/21039
1 changed files with 1 additions and 1 deletions
|
@ -332,7 +332,7 @@ private:
|
|||
Vector<u8> bytes;
|
||||
TRY_OR_THROW_OOM(vm, bytes.try_ensure_capacity(size));
|
||||
u64 byte_position = 0;
|
||||
while (position < vector.size()) {
|
||||
while (position < vector.size() && byte_position < size) {
|
||||
for (u8 i = 0; i < 4; ++i) {
|
||||
bytes.append(vector[position] >> (i * 8) & 0xFF);
|
||||
byte_position++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue