Avoid moving RawProps during animation backend commit when retries are possible#56465
Closed
bartlomiejbloniarz wants to merge 1 commit into
Closed
Avoid moving RawProps during animation backend commit when retries are possible#56465bartlomiejbloniarz wants to merge 1 commit into
bartlomiejbloniarz wants to merge 1 commit into
Conversation
…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
|
@bartlomiejbloniarz has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101161363. |
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? |
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
The
clonePropsfunction inAnimationBackend.cppwas usingstd::move(*animatedProps.rawProps)inside ashadowTree.commit()transaction lambda. Since commits can be retried (whencurrentRevision_.number != oldRevision.number), the moved-fromRawPropswould be in an unspecified state on the second attempt, leading to incorrect or undefined behavior.When
enableFabricCommitBranchingis enabled, commit retries are not a concern, so moving is safe. When disabled, we now copy viaRawProps(*animatedProps.rawProps)instead.This is the only dangerous move in the animation backend commit path. The
AnimationBackendCommitHookalready copies correctly (RawProps(*snapshot->rawProps)), andAnimatedPropsRegistry::getMap()is safe because moved pending data persists in themapmember 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