Crash to desktop with too high number in the ocean modifier resolution viewport value #83952

Closed
opened 2020-12-19 12:53:39 +01:00 by Reiner Prokein · 15 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.43

Blender Version
Broken: version: 2.92.0 Alpha, branch: master, commit date: 2020-12-19 06:25, hash: a5a302bd18

Short description of error
A high value like 1200 in the resolution viewport in the ocean modifier will crash Blender to desktop.

Exact steps for others to reproduce the error
[Please describe the exact steps needed to reproduce the issue]
[Based on the default startup or an attached .blend file (as simple as possible)]

Open Blender.
Add a ocean modifier.
Type in 1200 in the resolution viewport field.
Hit enter.
Crash.

resolutionviewportcrash.jpg

2020-12-19 12-52-49.mp4

The needed files with informations: blender_system_info.zip

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.43 **Blender Version** Broken: version: 2.92.0 Alpha, branch: master, commit date: 2020-12-19 06:25, hash: `a5a302bd18` **Short description of error** A high value like 1200 in the resolution viewport in the ocean modifier will crash Blender to desktop. **Exact steps for others to reproduce the error** [Please describe the exact steps needed to reproduce the issue] [Based on the default startup or an attached .blend file (as simple as possible)] Open Blender. Add a ocean modifier. Type in 1200 in the resolution viewport field. Hit enter. Crash. ![resolutionviewportcrash.jpg](https://archive.blender.org/developer/F9517765/resolutionviewportcrash.jpg) [2020-12-19 12-52-49.mp4](https://archive.blender.org/developer/F9517767/2020-12-19_12-52-49.mp4) The needed files with informations: [blender_system_info.zip](https://archive.blender.org/developer/F9535693/blender_system_info.zip)
Author

Added subscriber: @tiles

Added subscriber: @tiles

Added subscriber: @rjg

Added subscriber: @rjg

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

@tiles have you checked if you're running out of memory?

@tiles have you checked if you're running out of memory?
Author

Checked now. There is no significant memory increasement. It immediately crashes.

Checked now. There is no significant memory increasement. It immediately crashes.

Please open Blender's installation directory and double click on the blender_debug_gpu.cmd. This will start Blender in debug mode and create log files. Try to make Blender crash again. Once it crashes the Windows Explorer should open and show you up to two files, a debug log and the system information. Add them to your bug report by clicking on the upload button as shown in the screenshot below or via drag and drop. Please also upload the crash log located in C:\Users\[your username]\AppData\Local\Temp\[project name].crash.txt (or simply type %TEMP% into the path bar of the Windows Explorer).

2019_12_04_upload_icon_developer_blender_org.png

Please open Blender's installation directory and double click on the `blender_debug_gpu.cmd`. This will start Blender in debug mode and create log files. Try to make Blender crash again. Once it crashes the Windows Explorer should open and show you up to two files, a debug log and the system information. Add them to your bug report by clicking on the upload button as shown in the screenshot below or via drag and drop. Please also upload the crash log located in `C:\Users\[your username]\AppData\Local\Temp\[project name].crash.txt` (or simply type `%TEMP%` into the path bar of the Windows Explorer). ![2019_12_04_upload_icon_developer_blender_org.png](https://archive.blender.org/developer/F8190038/2019_12_04_upload_icon_developer_blender_org.png)
Author

Sure. I have updated the task and attached the files in the initial post. See blender_system_info.zip :)

Sure. I have updated the task and attached the files in the initial post. See blender_system_info.zip :)

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

The problem starts with an arithmetic overflow where the result of the operations is being cast to a size smaller than the real one.
The arithmetic overflow can be resolved with:

diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 1d62a1cce2a..034e8040a87 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -864,9 +864,10 @@ void BKE_ocean_init(struct Ocean *o,
   o->_do_chop = do_chop;
   o->_do_jacobian = do_jacobian;
 
-  o->_k = (float *)MEM_mallocN(M * (1 + N / 2) * sizeof(float), "ocean_k");
-  o->_h0 = (fftw_complex *)MEM_mallocN(M * N * sizeof(fftw_complex), "ocean_h0");
-  o->_h0_minus = (fftw_complex *)MEM_mallocN(M * N * sizeof(fftw_complex), "ocean_h0_minus");
+  o->_k = (float *)MEM_mallocN((size_t)M * (1 + (size_t)N / 2) * sizeof(float), "ocean_k");
+  o->_h0 = (fftw_complex *)MEM_mallocN((size_t)M * (size_t)N * sizeof(fftw_complex), "ocean_h0");
+  o->_h0_minus = (fftw_complex *)MEM_mallocN((size_t)M * (size_t)N * sizeof(fftw_complex),
+                                             "ocean_h0_minus");
   o->_kx = (float *)MEM_mallocN(o->_M * sizeof(float), "ocean_kx");
   o->_kz = (float *)MEM_mallocN(o->_N * sizeof(float), "ocean_kz");
 

But that does not solve the problem, since the amount of memory required is extremely high. Thus the malloc returns NULL.

Although we do not handle memory problems, this crash can be quite inconvenient, and this case does not appear to be something complicated to solve (perhaps it can be solved by limiting the maximum value).

So I'm confirming it as a bug.

The problem starts with an arithmetic overflow where the result of the operations is being cast to a size smaller than the real one. The arithmetic overflow can be resolved with: ``` diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index 1d62a1cce2a..034e8040a87 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -864,9 +864,10 @@ void BKE_ocean_init(struct Ocean *o, o->_do_chop = do_chop; o->_do_jacobian = do_jacobian; - o->_k = (float *)MEM_mallocN(M * (1 + N / 2) * sizeof(float), "ocean_k"); - o->_h0 = (fftw_complex *)MEM_mallocN(M * N * sizeof(fftw_complex), "ocean_h0"); - o->_h0_minus = (fftw_complex *)MEM_mallocN(M * N * sizeof(fftw_complex), "ocean_h0_minus"); + o->_k = (float *)MEM_mallocN((size_t)M * (1 + (size_t)N / 2) * sizeof(float), "ocean_k"); + o->_h0 = (fftw_complex *)MEM_mallocN((size_t)M * (size_t)N * sizeof(fftw_complex), "ocean_h0"); + o->_h0_minus = (fftw_complex *)MEM_mallocN((size_t)M * (size_t)N * sizeof(fftw_complex), + "ocean_h0_minus"); o->_kx = (float *)MEM_mallocN(o->_M * sizeof(float), "ocean_kx"); o->_kz = (float *)MEM_mallocN(o->_N * sizeof(float), "ocean_kz"); ``` But that does not solve the problem, since the amount of memory required is extremely high. Thus the malloc returns `NULL`. Although we do not handle memory problems, this crash can be quite inconvenient, and this case does not appear to be something complicated to solve (perhaps it can be solved by limiting the maximum value). So I'm confirming it as a bug.
Author

It is indeed inconvenient. I had 20 in the box as a value, tried to type in 21 in a hurry, and ended in 2021. The next thing i saw was my desktop.

Maybe this maximum value can be coupled to a setting, maximum available ram for example. So that people with more ram can use higher values here.

It is indeed inconvenient. I had 20 in the box as a value, tried to type in 21 in a hurry, and ended in 2021. The next thing i saw was my desktop. Maybe this maximum value can be coupled to a setting, maximum available ram for example. So that people with more ram can use higher values here.

Just as a reminder, we have a similar problems with other modifiers as well. This should likely be addressed in a consistent way for all modifiers.

Just as a reminder, we have a similar problems with other modifiers as well. This should likely be addressed in a consistent way for all modifiers.

This issue was referenced by 218df99410

This issue was referenced by 218df9941097bf973485ac343c070bdc6641a539

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Campbell Barton self-assigned this 2021-08-04 10:31:22 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#83952
No description provided.