Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1332)

Unified Diff: Source/modules/crypto/NormalizeAlgorithm.cpp

Issue 595873003: [webcrypto] Interpret empty BigInteger as 0 according to the spec (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move tests Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/crypto/rsa-ssa-generateKey-parseAlgorithm-failures-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/NormalizeAlgorithm.cpp
diff --git a/Source/modules/crypto/NormalizeAlgorithm.cpp b/Source/modules/crypto/NormalizeAlgorithm.cpp
index 53c8c555bcf44e1180b8de4666248a2dadfab821..758bde0df354cc7c89b831b8bbd33b0363908d5c 100644
--- a/Source/modules/crypto/NormalizeAlgorithm.cpp
+++ b/Source/modules/crypto/NormalizeAlgorithm.cpp
@@ -317,14 +317,10 @@ bool getBigInteger(const Dictionary& raw, const char* propertyName, RefPtr<Uint8
return false;
if (!array->byteLength()) {
- setSyntaxError(context.toString(propertyName, "BigInteger should not be empty"), error);
- return false;
+ // Empty BigIntegers represent 0 according to the spec
+ array = Uint8Array::create(1);
}
- if (!DictionaryHelper::get(raw, propertyName, array) || !array) {
- setSyntaxError(context.toString(propertyName, "Missing or not a Uint8Array"), error);
- return false;
- }
return true;
}
« no previous file with comments | « LayoutTests/crypto/rsa-ssa-generateKey-parseAlgorithm-failures-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698