mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-19 08:51:57 +00:00
LibWeb: Fix OBOE in bounds check of ResolvedCSSStyleDeclaration#item
Without this, it would return "(invalid CSS::PropertyID)" when requesting item(decl.length).
This commit is contained in:
parent
1a1fb14e26
commit
5aacb053a3
Notes:
github-actions[bot]
2024-11-14 18:51:40 +00:00
Author: https://github.com/Lubrsi
Commit: 5aacb053a3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2346
3 changed files with 10 additions and 1 deletions
|
@ -76,7 +76,7 @@ String ResolvedCSSStyleDeclaration::item(size_t index) const
|
||||||
{
|
{
|
||||||
// The item(index) method must return the property name of the CSS declaration at position index.
|
// The item(index) method must return the property name of the CSS declaration at position index.
|
||||||
// FIXME: Return custom properties if index > last_longhand_property_id.
|
// FIXME: Return custom properties if index > last_longhand_property_id.
|
||||||
if (index > length())
|
if (index >= length())
|
||||||
return {};
|
return {};
|
||||||
auto property_id = static_cast<PropertyID>(index + to_underlying(first_longhand_property_id));
|
auto property_id = static_cast<PropertyID>(index + to_underlying(first_longhand_property_id));
|
||||||
return string_from_property_id(property_id).to_string();
|
return string_from_property_id(property_id).to_string();
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
getComputedStyle().item(length) should return empty string: ''
|
|
@ -0,0 +1,8 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
const style = getComputedStyle(document.body);
|
||||||
|
println(`getComputedStyle().item(length) should return empty string: '${style.item(style.length)}'`);
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue