Skip to content

Commit 1fa2361

Browse files
authored
[browser] fix code gen overflow (#110539)
1 parent f0e1d7b commit 1fa2361

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSSignatureContext.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public static JSSignatureContext Create(
4848

4949
// there could be multiple method signatures with the same name, get unique signature name
5050
uint hash = 17;
51+
int typesHash;
5152
unchecked
5253
{
5354
foreach (var param in sigContext.ElementTypeInformation)
@@ -57,8 +58,8 @@ public static JSSignatureContext Create(
5758
foreach (char c in param.ManagedType.FullTypeName)
5859
hash = hash * 31 + c;
5960
}
61+
typesHash = (int)(hash & int.MaxValue);
6062
};
61-
int typesHash = Math.Abs((int)hash);
6263

6364
var fullName = $"{method.ContainingType.ToDisplayString()}.{method.Name}";
6465
string qualifiedName = GetFullyQualifiedMethodName(env, method);

0 commit comments

Comments
 (0)