Fix #113740: Crash adding layer into empty group #113852

Merged
Falk David merged 1 commits from filedescriptor/blender:fix-113740 into main 2023-10-17 18:34:50 +02:00
Member

This crash was cause by some mismatch in the indices.
We need to make sure to clamp the insertion index to the size of the
span of the layers.

This crash was cause by some mismatch in the indices. We need to make sure to clamp the insertion index to the size of the span of the layers.
Falk David added 1 commit 2023-10-17 17:55:23 +02:00
Fix #113740: Crash adding layer into empty group
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
e67e20590c
This crash was cause by some mismatch in the indices.
We need to make sure to clamp the insertion index to the size of the
span of the layers.
Author
Member

@blender-bot build

@blender-bot build
Falk David merged commit 78cb2776bb into main 2023-10-17 18:34:50 +02:00
Falk David deleted branch fix-113740 2023-10-17 18:34:52 +02:00
Contributor

Although this avoids the crash by clamping to_index to a valid value, I believe it still ends up choosing the wrong value for to_index, which I think means it incorrectly re-orders the custom data.

For example, starting with this (with no prior re-ordering):
Screenshot 2023-10-17 at 12.52.26 PM.png

If I move GP_Layer into GP_Group, then the correct value of to_index should be 1 (because GP_Layer.002 should stay last, at index 2). But the logic in find_layer_insertion_index() chooses a value of 2. (Prior to this patch it would have chosen a value of 3, which was also wrong, but that problem was masked by the resulting crash due to the out-of-bounds index.)

So, I will file a new issue for this, but wanted to document it here first for posterity, and so I could link to it in chat instead of pasting this as a wall of text there.

Although this avoids the crash by clamping `to_index` to a valid value, I believe it still ends up choosing the wrong value for `to_index`, which I think means it incorrectly re-orders the custom data. For example, starting with this (with no prior re-ordering): ![Screenshot 2023-10-17 at 12.52.26 PM.png](/attachments/dd640166-c376-480b-8d61-8ac3658d7457) If I move GP_Layer into GP_Group, then the correct value of `to_index` should be `1` (because GP_Layer.002 should stay last, at index 2). But the logic in `find_layer_insertion_index()` chooses a value of `2`. (Prior to this patch it would have chosen a value of `3`, which was also wrong, but that problem was masked by the resulting crash due to the out-of-bounds index.) So, I will file a new issue for this, but wanted to document it here first for posterity, and so I could link to it in chat instead of pasting this as a wall of text there.
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
2 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#113852
No description provided.