Search Issue Tracker

Won't Fix

Votes

0

Found in

2022.3.32f1

Issue ID

UUM-73376

Regression

No

Crash on DynamicHeapAllocator::Allocate when entering the Play Mode in a specific project

--

-

Reproduction steps:
1. Open the attached “ReproProj” project
2. Open the “Assets/Scenes/Gray&Threshold.unity” scene
3. Enter the Play Mode

Expected result: The Play Mode is entered
Actual result: The Editor crashes

Reproducible with: 2022.3.32f1, 6000.0.5f1
Couldn’t test with: 2021.3.39f1 (Memory Profiler errors)

Reproducible on: Windows 10
Not reproducible on: macOS 14.5 (M1 Max)

First few lines of the stack trace:
0x00007ff606108807 (Unity) tlsf_memalign
0x00007ff603eb2bf9 (Unity) DynamicHeapAllocator::Allocate
0x00007ff603ec18ac (Unity) DualThreadAllocator<DynamicHeapAllocator>::Allocate
0x00007ff603eb3381 (Unity) MemoryManager::Allocate
0x00007ff603ebd8ce (Unity) malloc_internal
0x00007ff604013e5d (Unity) core::vector_detail::vector_data::resize_buffer
0x00007ff6037a5fe8 (Unity) core::vector<signed char,0>::resize_buffer_nocheck
0x00007ff603e4cc85 (Unity) core::vector<signed char,0>::assign
0x00007ff6040b4ce1 (Unity) Texture2D::UnshareTextureData

  1. Resolution Note:

    The project uses OpenCVForUnity for processing. In particular, in script GrayScale, the call OpenCVForUnity_MatToTexture() is used to copy results to a Unity texture. This call writes out of bounds to the Unity Texture2D dstTexture. In particular, 2081600 bytes instead of 2073600 bytes were written out, causing memory corruption and Unity to crash. Unity is working as intended, there seems to be a bug in OpenCVForUnity_MatToTexture().

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.