WIP: Fix: is_overridable crash with certain ShapeKey functions parameters #118453

Draft
Philipp Oeser wants to merge 1 commits from lichtwerk/blender:106406 into blender-v4.1-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

Probably caused by 337e2c9029

rna_Property_overridable_get does rna_idproperty_check [which also
tries to set PropertyRNAOrID array_len].

In case of ShapeKey normals functions (normals_XXX_get()) "normals"
parameters, this then tries to get the length via e.g
rna_KeyBlock_normals_vert_len, but without an ID or owner_id. This is
OK (since we are querying just for the general function, so not with a
specific ID), but crashes since rna_ShapeKey_find_key further down the
line accesses the (NULL) ID.

So solution here is to guard in rna_ShapeKey_find_key against a non-ID
(and rightfully return NULL here).

NOTE there might be other cases where rna_Property_overridable_get
might fail after the behavior change of 337e2c9029 due to the above
(but havent spotted any nor found other reports about this).

Fixes #106406

Probably caused by 337e2c902930 `rna_Property_overridable_get` does `rna_idproperty_check` [which also tries to set `PropertyRNAOrID` `array_len`]. In case of ShapeKey normals functions (normals_XXX_get()) "normals" parameters, this then tries to get the length via e.g `rna_KeyBlock_normals_vert_len`, but without an ID or owner_id. This is OK (since we are querying just for the general function, so not with a specific ID), but crashes since `rna_ShapeKey_find_key` further down the line accesses the (NULL) ID. So solution here is to guard in `rna_ShapeKey_find_key` against a non-ID (and rightfully return NULL here). NOTE there might be other cases where `rna_Property_overridable_get` might fail after the behavior change of 337e2c902930 due to the above (but havent spotted any nor found other reports about this). Fixes #106406
Philipp Oeser added 1 commit 2024-02-19 11:27:09 +01:00
Probably caused by 337e2c9029

`rna_Property_overridable_get` does `rna_idproperty_check` [which also
tries to set `PropertyRNAOrID` `array_len`].

In case of ShapeKey normals functions (normals_XXX_get()) "normals"
parameters, this then tries to get the length via e.g
`rna_KeyBlock_normals_vert_len`, but without an ID or owner_id. This is
OK (since we are querying just for the general function, so not with a
specific ID), but crashes since `rna_ShapeKey_find_key` further down the
line accesses the (NULL) ID.

So solution here is to guard in `rna_ShapeKey_find_key` against a non-ID
(and rightfully return NULL here).

NOTE there might be other cases where `rna_Property_overridable_get`
might fail after the behavior change of 337e2c9029 due to the above
(but havent spotted any nor found other reports about this).

Fixes #106406
Philipp Oeser requested review from Bastien Montagne 2024-02-19 11:27:21 +01:00
Philipp Oeser added this to the Core project 2024-02-19 11:27:35 +01:00
Philipp Oeser added the
Interest
Python API
label 2024-02-19 11:27:41 +01:00
Bastien Montagne reviewed 2024-02-19 14:16:08 +01:00
Bastien Montagne left a comment
Owner

Generally change LGTM (although that RNA function could use some more cleanup).

What I do not understand though, is why rna_KeyBlock_normals_vert_len ends up being called, rna_property_rna_or_id_get should only call it if there is non-null data in the handled PointerRNA?

Generally change LGTM (although that RNA function could use some more cleanup). What I do not understand though, is why `rna_KeyBlock_normals_vert_len` ends up being called, `rna_property_rna_or_id_get` should only call it if there is non-null `data` in the handled `PointerRNA`?
Author
Member

image

Not exactly sure where this gets set, do you want me to dig deeper?

![image](/attachments/e2e5dbff-9077-4f65-a485-b4865a5ba3ce) Not exactly sure where this gets set, do you want me to dig deeper?
101 KiB

Wouldn't mind understanding fully what's happening here yes... Quite surprising that data would be a function (RNA accessor) :(

Wouldn't mind understanding fully what's happening here yes... Quite surprising that `data` would be a function (RNA accessor) :(

Can you also check the type of that PointerRNA?

Can you also check the `type` of that `PointerRNA`?
Author
Member

Can you also check the type of that PointerRNA?

That is a FloatProperty

Regarding data: will have to dig a bit further, but pretty sure this comes with RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_OUTPUT);

> Can you also check the `type` of that `PointerRNA`? That is a `FloatProperty` Regarding `data`: will have to dig a bit further, but pretty sure this comes with `RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_OUTPUT);`
Bastien Montagne changed title from Fix: `is_overridable` crash with certain ShapeKey functions parameters to WIP: Fix: `is_overridable` crash with certain ShapeKey functions parameters 2024-07-01 17:42:32 +02:00
Bastien Montagne removed this from the Core project 2024-07-01 17:46:39 +02:00
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 106406:lichtwerk-106406
git checkout lichtwerk-106406
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
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
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
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
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#118453
No description provided.