This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23017 - Specify numeric algorithm parameters with [EnforceRange]
Summary: Specify numeric algorithm parameters with [EnforceRange]
Status: RESOLVED FIXED
Alias: None
Product: Web Cryptography
Classification: Unclassified
Component: Web Cryptography API Document (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Mark Watson
QA Contact:
URL:
Whiteboard:
Keywords:
: 23779 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-08-20 01:22 UTC by Eric Roman
Modified: 2014-02-28 16:13 UTC (History)
2 users (show)

See Also:


Attachments

Description Eric Roman 2013-08-20 01:22:57 UTC
The default behavior of numbers in WebIDL is to wrap around.

For instance consider this WebCrypto parameter:
   unsigned long modulusLength;

If you were to specify a negative number for modulusLength then the spec says it should work, but silently convert to a positive number.

This seems like a bad pattern. It is likely that providing a negative number in a place which expected an unsigned number was a user error, and hence should trigger a failure.

I propose marking all numeric fields as [EnforceRange] so the user agent will throw a TypeError whenever the number is outside of the expected range.
Comment 1 Mark Watson 2014-02-28 01:47:13 UTC
Seems reasonable to me.
Comment 2 Mark Watson 2014-02-28 01:55:27 UTC
Changeset dad087725336
Comment 3 Mark Watson 2014-02-28 16:13:30 UTC
*** Bug 23779 has been marked as a duplicate of this bug. ***