Steps to reproduce:
1. Create a new project
2. In the Hierarchy window, right-click > 3D Objects > Terrain
3. Select the created Terrain
4. In the Inspector window navigate to Terrain > Terrain Settings > Texture Resolutions
5. Set Heightmap Resolution to “4097 x 4079”
6. Go to Paint Terrain
7. Set Brush Size and Opacity to any value
8. Rapidly click on the terrain in the Scene view to paint
Expected result: Terrain is painted without Unity Editor crashing
Actual result: After some time Unity Editor crashes while painting
Reproducible with: 2023.1.0a9, 2023.1.0b4, 2023.2.0a1
Not reproducible with: 2020.3.45f1, 2021.3.17f1, 2022.2.7f1, 2023.1.0a8
Reproducible on: Windows 10
Note: Look at the attached video for clarity
Stack Trace:
UndoManager::EraseUndos
UndoManager::SerializeErasedUndo
UndoManager::PopFrontIfExceedsLimit
UndoManager::RegisterUndoOperation
UndoManager::RegisterUndoInternal