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

Reply via email to