Skip to content

Avoid moving RawProps during animation backend commit when retries are possible#56465

Open
bartlomiejbloniarz wants to merge 1 commit intomainfrom
export-D101161363
Open

Avoid moving RawProps during animation backend commit when retries are possible#56465
bartlomiejbloniarz wants to merge 1 commit intomainfrom
export-D101161363

Conversation

@bartlomiejbloniarz
Copy link
Copy Markdown
Contributor

Summary:
The cloneProps function in AnimationBackend.cpp was using std::move(*animatedProps.rawProps) inside a shadowTree.commit() transaction lambda. Since commits can be retried (when currentRevision_.number != oldRevision.number), the moved-from RawProps would be in an unspecified state on the second attempt, leading to incorrect or undefined behavior.

When enableFabricCommitBranching is enabled, commit retries are not a concern, so moving is safe. When disabled, we now copy via RawProps(*animatedProps.rawProps) instead.

This is the only dangerous move in the animation backend commit path. The AnimationBackendCommitHook already copies correctly (RawProps(*snapshot->rawProps)), and AnimatedPropsRegistry::getMap() is safe because moved pending data persists in the map member across retries.

Changelog: [General][Fixed] - Fix potential data corruption in animation backend when ShadowTree commits are retried by copying RawProps instead of moving them

Differential Revision: D101161363

…e possible

Summary:
The `cloneProps` function in `AnimationBackend.cpp` was using `std::move(*animatedProps.rawProps)` inside a `shadowTree.commit()` transaction lambda. Since commits can be retried (when `currentRevision_.number != oldRevision.number`), the moved-from `RawProps` would be in an unspecified state on the second attempt, leading to incorrect or undefined behavior.

When `enableFabricCommitBranching` is enabled, commit retries are not a concern, so moving is safe. When disabled, we now copy via `RawProps(*animatedProps.rawProps)` instead.

This is the only dangerous move in the animation backend commit path. The `AnimationBackendCommitHook` already copies correctly (`RawProps(*snapshot->rawProps)`), and `AnimatedPropsRegistry::getMap()` is safe because moved pending data persists in the `map` member across retries.

Changelog: [General][Fixed] - Fix potential data corruption in animation backend when ShadowTree commits are retried by copying RawProps instead of moving them

Differential Revision: D101161363
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 16, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Apr 16, 2026

@bartlomiejbloniarz has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101161363.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant