Commit 81e78fcb authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

Properly decode JS message before executing.

The command parameter can contain not ascii characters
which will not be decoded correctly by fromCharCode.
Using TextDecoder will be more robust to decode the
string.

Bug: 950538
Change-Id: Ia7495c328582585ab8d47038b3c0bd192a40fe37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1556848
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarMike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#648736}
parent 4b3b6a43
......@@ -273,8 +273,7 @@ var executeMessage_ = function(payload, iv) {
getFrameSymmetricKey_(function(frameKey) {
window.crypto.subtle.decrypt(algorithm, frameKey, encryptedFunctionArray)
.then(function(decrypted) {
var callJSON =
String.fromCharCode.apply(null, new Uint8Array(decrypted));
var callJSON = new TextDecoder().decode(new Uint8Array(decrypted));
var callDict = JSON.parse(callJSON);
// Verify that message id is valid.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment