W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2011

[whatwg] How should overflow be handled when parsing integers?

From: Mounir Lamouri <mounir@lamouri.fr>
Date: Sun, 16 Oct 2011 20:02:35 +0200
Message-ID: <4E9B1C3B.50405@lamouri.fr>
On 10/16/2011 02:17 PM, Daniel Bates wrote:
> How should overflow be handled when parsing integers?
>
> Step 8 of the parsing algorithm in both<http://dev.w3.org/html5/spec/Overview.html#rules-for-parsing-integers>  and<http://dev.w3.org/html5/spec/Overview.html#non-negative-integers>  doesn't mention how to handle integer overflow when interpreting the result of a sequence of base-ten integers.
>
> Currently in WebKit we consider such overflow a parsing error. Is there any reason not to consider overflow a parsing error? Regardless, I suggest codifying the handling of overflow in the aforementioned sections.

Gecko also considers that an overflow is a parsing error. Presto and IE6 
doesn't seem to.
The specs should probably mention this by whether consider it as a 
parsing error or request the UA to default to the highest value (which 
Presto and IE6 seem to do but not using the same value).

> This issue came up recently in WebKit with respect to the parsing of the maxlength attribute (https://bugs.webkit.org/show_bug.cgi?id=68981).

Actually, this problem wouldn't have been that annoying if Webkit was 
following the specs regarding maxlength attribute: if the content 
attribute value isn't a valid non-negative integer, the element has no 
maximum allowed value length.

--
Mounir
Received on Sunday, 16 October 2011 11:02:35 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:37 UTC