Skip to content

Commit 112ec73

Browse files
ljharbtargos
authored andcommitted
util: isEqualBoxedPrimitive: ensure both values are actual boxed Symbols
... before trying to valueOf them PR-URL: #29029 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 8426077 commit 112ec73

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/internal/util/comparisons.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@ function isEqualBoxedPrimitive(val1, val2) {
9898
return isBigIntObject(val2) &&
9999
BigIntPrototype.valueOf(val1) === BigIntPrototype.valueOf(val2);
100100
}
101-
return isSymbolObject(val2) &&
102-
SymbolPrototype.valueOf(val1) === SymbolPrototype.valueOf(val2);
101+
if (isSymbolObject(val1)) {
102+
return isSymbolObject(val2) &&
103+
SymbolPrototype.valueOf(val1) === SymbolPrototype.valueOf(val2);
104+
}
105+
return false;
103106
}
104107

105108
// Notes: Type tags are historical [[Class]] properties that can be set by

0 commit comments

Comments
 (0)