Unity Issue Tracker - “ArgumentOutOfRangeException: Length cannot be less than zero.“ error or “NullReferenceException: Object reference not set to an instance of an object“ error is thrown when CoreUnsafeUtils.FixedBufferStringQueue reads out of bounds
Fixed
UUM-104687
“ArgumentOutOfRangeException: Length cannot be less than zero.“ error or “NullReferenceException: Object reference not set to an instance of an object“ error is thrown when CoreUnsafeUtils.FixedBufferStringQueue reads out of bounds
Unity: SRP Foundation
Fixed
6.2.X
6.1.X
6.0.X
Won't Fix
2022.3.X
Thank you for the detailed analysis and sample code to trigger the issue! This will be fixed.
Reproduction steps:
1. Open the attached “repro_IN-99424“ project
2. Enter the “Assets/OutdoorsScene.unity“ Scene
3. In the Editor menu, select “Test → Run“
4. Observe the Console
Expected result: No errors appear in the Console
Actual result: “ArgumentOutOfRangeException: Length cannot be less than zero.“ error or “NullReferenceException: Object reference not set to an instance of an object“ error is thrown in the Console
Reproducible with: 2022.3.62f1, 6000.0.48f1, 6000.1.2f1, 6000.2.0a10
Couldn’t test with: 2022.1.0a1-2022.2.0a1 - Crashes on winutils::ExternalCrashHandler::HandleCrash when launching the project
Reproducible on: Windows 10 (22H2), macOS Sequoia 15.3 (M2 Ultra)
Not reproducible on: No other environments tested
Notes:
There’s a small possibility that after doing the 3rd step, the Editor will crash on memcpy (the reporter was able to reproduce this crash on 6000.0.46f1; CQA was only able to reproduce this crash on 6000.2.0a10)
“ArgumentOutOfRangeException: Length cannot be less than zero.“ error appears on 2022.3.61f1, 6000.1.2f1 (first “Test → Run”), and 6000.2.0a10
“NullReferenceException: Object reference not set to an instance of an object“ error appears on 6000.0.48f1 and on 6000.1.2f1 (from the second and ongoing “Test → Run“)
Prioritise and Follow this issue
Have a workaround or additional info about this issue?