Crash creating "position" attribute with the wrong type while in Edit mode #107232

Closed
opened 2023-04-22 03:12:26 +02:00 by Thomas Barlow · 4 comments
Member

System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 531.41

Blender Version
Broken: 3.5.0 and 3.6.0 Alpha, branch: main, commit date: 2023-04-20 23:46, hash: 5721b34e5364
Worked:

Short description of error
While in Edit mode, attempting to create an attribute called "position" that has type not set to "FLOAT_VECTOR" will crash Blender.

I couldn't get any other attributes to crash when added while in Edit mode.
Creating the "position" attribute with the correct type, but incorrect domain does not cause a crash either.

I can't imagine a use case for users wanting to do this, but it came up while I was determining the extent of #107228 and isn't really the same issue.

Exact steps for others to reproduce the error

  1. Select a mesh object
  2. Enter Edit Mode
  3. Either:
    1. Run bpy.context.object.data.attributes.new("position", "FLOAT", "POINT") from the Python Console
    2. Create a new attribute called "position" using the bpy.ops.geometry.attribute_add operator and set the Data Type to anything other than Vector: image
**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 531.41 **Blender Version** Broken: 3.5.0 and 3.6.0 Alpha, branch: main, commit date: 2023-04-20 23:46, hash: `5721b34e5364` Worked: **Short description of error** While in Edit mode, attempting to create an attribute called `"position"` that has type not set to `"FLOAT_VECTOR"` will crash Blender. I couldn't get any other attributes to crash when added while in Edit mode. Creating the `"position"` attribute with the correct type, but incorrect domain does not cause a crash either. I can't imagine a use case for users wanting to do this, but it came up while I was determining the extent of https://projects.blender.org/blender/blender/issues/107228 and isn't really the same issue. **Exact steps for others to reproduce the error** 1. Select a mesh object 1. Enter Edit Mode 1. Either: 1. Run `bpy.context.object.data.attributes.new("position", "FLOAT", "POINT")` from the Python Console 1. Create a new attribute called "position" using the `bpy.ops.geometry.attribute_add` operator and set the `Data Type` to anything other than `Vector`: ![image](/attachments/13556957-8f36-47b0-8088-a9c53a2c8397)
143 KiB
Thomas Barlow added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-04-22 03:12:27 +02:00
Iliya Katushenock added the
Interest
Modeling
label 2023-04-22 10:02:12 +02:00
Jesse Yurkovich added
Module
Nodes & Physics
Status
Confirmed
and removed
Status
Needs Triage
labels 2023-04-22 23:30:51 +02:00
Member

The crash is because positions are always accessed/treated as CD_PROP_FLOAT3 / float3 around code [without checking], but this is not a given if we let users create "builtin" attributes with other types.

@HooglyBoogly : shouldnt we really guard against creating attributes with used builtin names?

Here is another unfortunate case:

  • even if you create the "position" attribute with the correct type (Vector) in editmode, that will complete wipe/destroy the original coords
  • looks like this then:

image

going into objectmode afterwards then makes your mesh collapse.

Does the whole issue deserve High priority?
(will raise for the moment to get the crash out of the way, feel free to lower again though...)

The crash is because positions are always accessed/treated as `CD_PROP_FLOAT3` / `float3` around code [without checking], but this is not a given if we let users create "builtin" attributes with other types. @HooglyBoogly : shouldnt we really guard against creating attributes with used builtin names? Here is another unfortunate case: - even if you create the "position" attribute with the correct type (Vector) in editmode, that will complete wipe/destroy the original coords - looks like this then: ![image](/attachments/64297c32-b604-4282-81c4-c65d4c838b2a) going into objectmode afterwards then makes your mesh collapse. Does the whole issue deserve High priority? (will raise for the moment to get the crash out of the way, feel free to lower again though...)
221 KiB
Philipp Oeser added
Priority
High
and removed
Priority
Normal
labels 2024-02-16 14:42:31 +01:00
Member

shouldnt we really guard against creating attributes with used builtin names?

Yes, we should. The difference in builtin attributes between BMesh and other areas is a problem area.

You sort of have to go out of your way to do this though, which is why I didn't prioritize making it safer so far. But other perspectives make sense too.

> shouldnt we really guard against creating attributes with used builtin names? Yes, we should. The difference in builtin attributes between BMesh and other areas is a problem area. You sort of have to go out of your way to do this though, which is why I didn't prioritize making it safer so far. But other perspectives make sense too.
Hans Goudey added
Type
Bug
and removed
Type
Report
labels 2024-02-16 14:52:44 +01:00
Hans Goudey self-assigned this 2024-03-05 22:30:45 +01:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-03-06 16:16:59 +01:00
Member

I assume we want this bckported to 3.6 LTS @HooglyBoogly ?

I assume we want this bckported to 3.6 LTS @HooglyBoogly ?
Member

Sure, couldn't hurt, it's a pretty simple change.

Sure, couldn't hurt, it's a pretty simple change.
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
3 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#107232
No description provided.