Skip to content

Commit f3b3e2f

Browse files
Jake ChampionJakeChampion
authored andcommitted
protect against a potentially missing hash property in the algorithm object of a supplied cryptokey
1 parent 8006cb0 commit f3b3e2f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

c-dependencies/js-compute-runtime/builtins/crypto-algorithm.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ const EVP_MD *createDigestAlgorithm(JSContext *cx, JS::HandleObject key) {
1717

1818
JS::RootedValue hash_val(cx);
1919
JS_GetProperty(cx, alg, "hash", &hash_val);
20+
if (!hash_val.isObject()) {
21+
JS_ReportErrorLatin1(cx, "NotSupportedError");
22+
return nullptr;
23+
}
2024
JS::RootedObject hash(cx, &hash_val.toObject());
2125
JS::RootedValue name_val(cx);
2226
JS_GetProperty(cx, hash, "name", &name_val);

0 commit comments

Comments
 (0)