Fix randomized track ID generation in CanvasCaptureHandler.

Presently it can end up being truncated if a zero byte is generated in the
random output, yielding less entropy than intended (1/256 of outputs are
the empty string, for instance).

We can also use a stack buffer for holding the random data, since it's of a
small fixed size, and skip a UTF-8 decoding pass since Blink knows how to make
an 8-bit string directly in such cases (Base64 output is always pure ASCII).

Change-Id: I215f3ac4430a9e32f2a897e905128c8337aaa27d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1655377
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#668805}
1 file changed