Skip to content

Fix AssetChanged<A> UB#23138

Open
Trashtalk217 wants to merge 5 commits intobevyengine:mainfrom
Trashtalk217:fix-asset-changed
Open

Fix AssetChanged<A> UB#23138
Trashtalk217 wants to merge 5 commits intobevyengine:mainfrom
Trashtalk217:fix-asset-changed

Conversation

@Trashtalk217
Copy link
Contributor

Objective

Fixes #23057.

Solution

Uses Nested Queries from #21557 to also register the resource entity to the access set.

Testing

Added an extra test.

@alice-i-cecile alice-i-cecile added this to the 0.19 milestone Feb 25, 2026
@alice-i-cecile
Copy link
Member

Regression test please :)

@Trashtalk217 Trashtalk217 added C-Bug An unexpected or incorrect behavior A-Assets Load files from disk to use for things like images, models, and sounds labels Feb 25, 2026
@github-project-automation github-project-automation bot moved this to Needs SME Triage in Assets Feb 25, 2026
@Trashtalk217
Copy link
Contributor Author

I did. That's the extra test I added.

@Trashtalk217 Trashtalk217 added the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label Feb 25, 2026
@alice-i-cecile alice-i-cecile added the P-Unsound A bug that results in undefined compiler behavior label Feb 25, 2026
@alice-i-cecile
Copy link
Member

Ah sorry, missed that!

Copy link
Contributor

@chescock chescock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!

One nit on comments: GitHub won't let me comment there, but there is a safety comment in init_fetch that says

        // - `update_component_access` declares a read on `state.resource_id`, so it is safe to
        //   read that resource here (see trait-level safety comments on `WorldQuery`, regarding
        //   readonly resource access in `init_fetch`)

and should probably be changed to mention init_nested_access instead.

Trashtalk217 and others added 2 commits February 26, 2026 16:13
Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior P-Unsound A bug that results in undefined compiler behavior S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

Potential for UB in systems using AssetChanged

3 participants