Incorrect crypto.getRandomValues() max length

RESOLVED INVALID

Status

()

Core
Security
RESOLVED INVALID
2 years ago
2 years ago

People

(Reporter: Lcf.vs, Unassigned)

Tracking

43 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:43.0) Gecko/20100101 Firefox/43.0
Build ID: 20151223140742

Steps to reproduce:

Hi all,

I'm trying to make a random values with a length between 0 and 65536 :

crypto.getRandomValues(new Uint16Array(length));


Actual results:

It fails if length is greater than 32768 (QuotaExceededError)


Expected results:

crypto.getRandomValues() must follow the related doc :

"A QuotaExceededError DOMException is thrown if the requested length is greater than 65536 bytes."

Updated

2 years ago
Component: Untriaged → DOM: Security
Product: Firefox → Core
Component: DOM: Security → Security
(In reply to Lcf.vs from comment #0)
> crypto.getRandomValues(new Uint16Array(length));
...
> It fails if length is greater than 32768 (QuotaExceededError)
...
> "A QuotaExceededError DOMException is thrown if the requested length is
> greater than 65536 bytes."

Unless I'm misunderstanding, a Uint16Array of length longer than 32768 will have a length in bytes greater than 65536, so I believe the implementation is already spec-compliant here.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.