mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-04 17:33:04 +00:00
LibWeb: Fix StringView OOB access when parsing 3-character legacy color
Found by Domato.
This commit is contained in:
parent
7360f7fbc6
commit
1c00e5688d
Notes:
github-actions[bot]
2024-07-20 07:32:06 +00:00
Author: https://github.com/awesomekling
Commit: 1c00e5688d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/721
3 changed files with 11 additions and 0 deletions
|
@ -4879,6 +4879,9 @@ Optional<Color> parse_legacy_color_value(StringView string)
|
|||
}
|
||||
|
||||
auto to_hex = [&](StringView string) -> u8 {
|
||||
if (length == 1) {
|
||||
return hex_nibble_to_u8(string[0]);
|
||||
}
|
||||
auto nib1 = hex_nibble_to_u8(string[0]);
|
||||
auto nib2 = hex_nibble_to_u8(string[1]);
|
||||
return nib1 << 4 | nib2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue