[Webkit-unassigned] [Bug 252097] Enforce HTML range restriction on setting unsigned attribute values

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 22 06:08:15 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=252097

Ahmad Saleem <ahmad.saleem792 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #5 from Ahmad Saleem <ahmad.saleem792 at gmail.com> ---
We are already doing it:

void Element::setUnsignedIntegralAttribute(const QualifiedName& attributeName, unsigned value)
{
    setAttribute(attributeName, AtomString::number(limitToOnlyHTMLNonNegative(value)));
}

>From this `limitToOnlyHTMLNonNegative`:

// https://html.spec.whatwg.org/#reflecting-content-attributes-in-idl-attributes:idl-unsigned-long
inline unsigned limitToOnlyHTMLNonNegative(unsigned value, unsigned defaultValue = 0)
{
    ASSERT(defaultValue <= maxHTMLNonNegativeInteger);
    return value <= maxHTMLNonNegativeInteger ? value : defaultValue;
}

and then `maxHTMLNonNegativeInteger` goes to:

static const unsigned maxHTMLNonNegativeInteger = 2147483647;

Blink proposed - 0x7fffffffu = 2147483647 (in Decimal).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240522/c7b67b0f/attachment.htm>


More information about the webkit-unassigned mailing list