Modal knife tool can crash if used on hidden object #116262

Closed
opened 2023-12-17 05:52:09 +01:00 by fist-in-face · 5 comments

System Information
Operating system: Windows 11
Graphics card: Gt 1030

Blender Version
Broken: version: 3.6.7, branch: blender-v3.6-release, commit date: 2023-12-11 16:28, hash: cbd81f283d58
Broken: 3.5
Worked: (newest version of Blender that worked as expected)

Short description of error
if I cut an object that I cant see with the knife tool it just auto closes blender

Exact steps for others to reproduce the error

  1. select cube in new scene
  2. go to edit mode
  3. select the knife tool
  4. cut the cube making a shape in it like a triangle or square
  5. then press space to save the cut
  6. then press the eye icon on the cube
  7. try to cut the invisible cube
    note this glitch only happens sometimes.
    Based on the default startup or an attached .blend file (as simple as possible).
ExceptionCode         : EXCEPTION_ACCESS_VIOLATION
Exception Address     : 0x00007FF785B87A00
Exception Module      : blender.exe
Exception Flags       : 0x00000000
Exception Parameters  : 0x2
	Parameters[0] : 0x0000000000000000
	Parameters[1] : 0x0000000000000030


Stack trace:
blender.exe         :0x00007FF785B87A00  mul_v3_m4v3
blender.exe         :0x00007FF78229D660  get_bm_knife_vert
blender.exe         :0x00007FF7822A0DF0  knife_get_face_kedges
blender.exe         :0x00007FF78229EDD0  knife_find_closest_edge_of_face
blender.exe         :0x00007FF7822A2610  knife_snap_update_from_mval
blender.exe         :0x00007FF7822A2E60  knife_update_active
blender.exe         :0x00007FF7822A6AD0  knifetool_update_mval_i
blender.exe         :0x00007FF7822A5610  knifetool_modal
**System Information** Operating system: Windows 11 Graphics card: Gt 1030 **Blender Version** Broken: version: 3.6.7, branch: blender-v3.6-release, commit date: 2023-12-11 16:28, hash: `cbd81f283d58` Broken: 3.5 Worked: (newest version of Blender that worked as expected) **Short description of error** if I cut an object that I cant see with the knife tool it just auto closes blender **Exact steps for others to reproduce the error** 1. select cube in new scene 2. go to edit mode 3. select the knife tool 4. cut the cube making a shape in it like a triangle or square 5. then press space to save the cut 6. then press the eye icon on the cube 7. try to cut the invisible cube note this glitch only happens sometimes. Based on the default startup or an attached .blend file (as simple as possible). ``` ExceptionCode : EXCEPTION_ACCESS_VIOLATION Exception Address : 0x00007FF785B87A00 Exception Module : blender.exe Exception Flags : 0x00000000 Exception Parameters : 0x2 Parameters[0] : 0x0000000000000000 Parameters[1] : 0x0000000000000030 Stack trace: blender.exe :0x00007FF785B87A00 mul_v3_m4v3 blender.exe :0x00007FF78229D660 get_bm_knife_vert blender.exe :0x00007FF7822A0DF0 knife_get_face_kedges blender.exe :0x00007FF78229EDD0 knife_find_closest_edge_of_face blender.exe :0x00007FF7822A2610 knife_snap_update_from_mval blender.exe :0x00007FF7822A2E60 knife_update_active blender.exe :0x00007FF7822A6AD0 knifetool_update_mval_i blender.exe :0x00007FF7822A5610 knifetool_modal ```
fist-in-face added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-12-17 05:52:10 +01:00

Confirmed in 3.6 as well as 4.x

Confirmed in 3.6 as well as 4.x
Jesse Yurkovich added
Module
Modeling
Status
Confirmed
and removed
Status
Needs Triage
labels 2023-12-17 07:04:32 +01:00
Jesse Yurkovich changed title from knife tool to Modal knife tool can crash if used on hidden object 2023-12-17 07:08:38 +01:00
Member

Looked into this a bit, think I can fix

Looked into this a bit, think I can fix
Philipp Oeser self-assigned this 2023-12-18 13:50:44 +01:00
Member

Looks like kcd->objects_len is 0 because hidden objects (BKE_base_is_visible) are not iterated in FOREACH_BASE_IN_MODE_BEGIN. So the kcd->objects_info points to garbage memory.
Not sure what should be the fix here. Mismatch between objects_len and objects_info array len can easily happen.
BTW crash does not happen in 3.3

Looks like `kcd->objects_len` is 0 because hidden objects (`BKE_base_is_visible`) are not iterated in `FOREACH_BASE_IN_MODE_BEGIN`. So the `kcd->objects_info` points to garbage memory. Not sure what should be the fix here. Mismatch between `objects_len` and `objects_info` array len can easily happen. BTW crash does not happen in 3.3
Member

I can get 3.3 to crash as well.

The most apparent problem is the case when objects_len is zero, but actually this mismatch can have other bad consequences because of the garbage memory. Stuff behaves unexpected if you for example have multiple objects in editmode and hide some of them.

Following the principle of "never act on hidden stuff", I think it is actually wrong to include a backbuffer fallback in knife_find_closest_face when raycasting fails, this makes all following code confusing/wrong since we are working with coordinates / faces under the assumption there would be a valid/corresponding object to it in KnifeTool_OpData > objects -- which is not the case...

Still thinking of where the best place would be to prevent all this...

I can get 3.3 to crash as well. The most apparent problem is the case when `objects_len` is zero, but actually this mismatch can have other bad consequences because of the garbage memory. Stuff behaves unexpected if you for example have multiple objects in editmode and hide some of them. Following the principle of "never act on hidden stuff", I think it is actually wrong to include a backbuffer fallback in `knife_find_closest_face` when raycasting fails, this makes all following code confusing/wrong since we are working with coordinates / faces under the assumption there would be a valid/corresponding object to it in `KnifeTool_OpData` > `objects` -- which is not the case... Still thinking of where the best place would be to prevent all this...
Member

Since this is a crasher, will also raise priority here

Since this is a crasher, will also raise priority here
Philipp Oeser added
Priority
High
and removed
Priority
Normal
labels 2024-03-12 16:04:08 +01:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-03-12 17:02:51 +01: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
4 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#116262
No description provided.