Skip to content

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

Closed
bartlomiejbloniarz wants to merge 1 commit into
mainfrom
export-D101161363
Closed

Avoid moving RawProps during animation backend commit when retries are possible#56465
bartlomiejbloniarz wants to merge 1 commit into
mainfrom
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.

@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Apr 16, 2026
@meta-codesync meta-codesync Bot closed this in 77d3df8 Apr 17, 2026
@react-native-bot react-native-bot added the Merged This PR has been merged. label Apr 17, 2026
@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by Bartlomiej Bloniarz in 77d3df8

When will my fix make it into a release? | How to file a pick request?

@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Apr 17, 2026

This pull request has been merged in 77d3df8.

alanjhughes pushed a commit that referenced this pull request Apr 20, 2026
…e possible (#56465)

Summary:
Pull Request resolved: #56465

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

Reviewed By: zeyap

Differential Revision: D101161363

fbshipit-source-id: 43b9277f37563098c8ba878777d7a3099bdf1373
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 Merged This PR has been merged. 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.

2 participants