JSSignatureContext.cs may include incorrect use of Math.Abs #84996
Labels
arch-wasm
WebAssembly architecture
area-System.Runtime.InteropServices.JavaScript
in-pr
There is an active PR which will close this issue when it is merged
os-browser
Browser variant of arch-wasm
Milestone
runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSSignatureContext.cs
Lines 49 to 58 in 790b14b
The last line does not seem correct. If
(int)hash == int.MinValue
,Math.Abs
would throw, which I suppose is not the intended behaviour for a hash function. I would suggest simplyint typesHash = (int)hash & int.MaxValue;
, or if the hash code is required to be persistent across versions,int typesHash = (int)hash == int.MinValue ? int.MaxValue : Math.Abs((int)hash)
.The text was updated successfully, but these errors were encountered: