Search Issue Tracker

By Design

Votes

0

Found in

2018.3.0a1

2018.3.1f1

2019.1.0a1

2019.2.0a1

Issue ID

1117993

Regression

Yes

[WebGL] In developer build method Mathf.CeilToInt() throws an exception

WebGL

-

Steps to reproduce:
1. Download 117993_repro.zip project
2. Build for WebGL Developer Build
3. Open index.html in a web browser

Expected results: returns -2147483647 value
Actual results: Mathf.CeilToInt() throws an exception

Reproduced with: 2019.2.0a1, 2019.1.0a14, 2018.3.3f1
Not reproducible in: 2017.4.18f1

Exception:
exception thrown: RuntimeError: integer overflow,_Mathf_CeilToInt_m0230CCC7CC9266F18125D9425C38A25D1CA4275B@blob:null/97ece9de-a606-46b9-a946-c044d7947787 line 1379 > WebAssembly.instantiate:wasm-function[33195]:0x85e16e
_TestCeil_Start_m89B55F5DD7E7290449C2F37AC1F6D50326337F47@blob:null/97ece9de-a606-46b9-a946-c044d7947787 line 1379 > WebAssembly.instantiate:wasm-function[43820]:0xa75090
<...>

  1. Response avatar

    Resolution Note (fix version 2019.2):

    This is not a bug. In development build, we have additional checks for undefined behaviour, like Mathf.CeilToInt(float.PositiveInfinity).

    C# says in https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/explicit-numeric-conversions-table
    "In a checked context, an OverflowException is thrown, while in an unchecked context, the result is an unspecified value of the destination type."

    C++ (that is generated during il2cpp) also doesn't support int overflow.

    To solve this please make sure you have correct input for CeilToInt first.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.