Search Issue Tracker

Fixed

Fixed in 2021.3.30f1, 2022.3.11f1, 2023.1.11f1, 2023.2.0b7, 2023.3.0a6, 2024.1.0a1

Votes

0

Found in

2021.3.29f1

2022.3.7f1

2023.1.7f1

2023.2.0b2

2024.1.0a1

Issue ID

UUM-45551

Regression

No

[IL2CPP] Player crash when DivideByZeroChecks are not inserted

--

-

Reproduction steps:
1. Open the attached project “CrashRepro“
2. Build and run (File > Build And Run)
3. Click on any of the 3 buttons

Expected result: IL2CPP injects division by zero checks for integer division and throws managed DivideByZeroException exception
Actual result: The Player crashes

Reproducible with: 2021.3.29f1, 2022.3.7f1, 2023.1.7f1, 2023.2.0b2

Reproducible on: Windows 10

First few lines of stack trace:

{noformat}0x00007FF9686F9E61 (GameAssembly) [C:\Users\klaid\Desktop\Cases\IN-50301_DivideByZero\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\Assembly-CSharp.cpp:833] DivisionByZeroTest_UseTryCatch_m68417933F30642B643323F59822402A214072BBE
0x00007FF9686F96BD (GameAssembly) [C:\Users\klaid\Desktop\Cases\IN-50301_DivideByZero\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\Assembly-CSharp.cpp:755] DivisionByZeroTest_OnGUI_m81204F7C81CC6FAFE1193B3642AE3711895B540C
0x00007FF96830D571 (GameAssembly) [C:\Users\klaid\Desktop\Cases\IN-50301_DivideByZero\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\Il2CppInvokerTable.cpp:13629] RuntimeInvoker_TrueVoid_t4861ACF8F4594C3437BB48B6E56783494B843915
0x00007FF96842AE62 (GameAssembly) [C:\Program Files\Unity\2022.3.7f1_b16b3b16c7a0\Data\il2cpp\libil2cpp\vm\Runtime.cpp:605] il2cpp::vm::Runtime::InvokeWithThrow
0x00007FF96842A452 (GameAssembly) [C:\Program Files\Unity\2022.3.7f1_b16b3b16c7a0\Data\il2cpp\libil2cpp\vm\Runtime.cpp:590] il2cpp::vm::Runtime::Invoke
0x00007FF9684917C2 (GameAssembly) [C:\Program Files\Unity\2022.3.7f1_b16b3b16c7a0\Data\il2cpp\libil2cpp\il2cpp-api.cpp:1128] il2cpp_runtime_invoke {noformat}

  1. Resolution Note (fix version 2024.1.0a1):

    Added Modulo/Remainder to the divide by zero checks

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.