Stable 1.83.19 Hotfix#880
Open
neon-nyan wants to merge 14 commits into
Open
Conversation
This due to absence of the ScreenSettingData while the game has never been played before.
Comment on lines
+329
to
+332
| // Fall back to 128-bit vectors | ||
| else if (Vector128.IsHardwareAccelerated) | ||
| { | ||
| long offsetRemained = CBufferSize % Vector128<byte>.Count; |
There was a problem hiding this comment.
Bug: The SIMD loop processes uninitialized ArrayPool memory when reading the end of a file, causing the patched output file to be corrupted.
Severity: HIGH
Suggested Fix
The SIMD addition loops should be modified to only process the number of bytes actually read into the oldData buffer, which is availableInputBytes. Alternatively, the rented ArrayPool buffer could be zero-initialized before use to prevent processing garbage data.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: CollapseLauncher/Classes/RepairManagement/BSDiff.cs#L329-L332
Potential issue: In the `BSDiff.cs` patching logic, when processing the end of an input
file, the number of bytes read into the `oldData` buffer (`availableInputBytes`) can be
less than the buffer's full size (`CBufferSize`). However, the subsequent SIMD
processing loops iterate over the entire `oldData` buffer, including the uninitialized
portion containing garbage data from the `ArrayPool`. This garbage data is then added to
the `newData` buffer and written to the output file, causing file corruption. This issue
occurs whenever the patching process reaches the end of the input file.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
What's changed? - 1.83.19
MhyMurmurHash264B(like Blocks and Audio files) sometimes causes exception if data length doesn't matchFull Changelog: CL-v1.83.18...CL-v1.83.19
Code Signing Policy