Repository navigation
Conversation
GetListCounts threw when DATA was not exactly 4 bytes per FormID counted in XCNT, so a FootstepSet carrying surplus DATA bytes failed to parse. xEdit sizes each DATA array from its XCNT count and shows the leftover bytes as unused data, and the game reads by the counts too, so both load such a record. Both readers now read each list by its count and then move to the end of DATA, so the surplus is skipped and the next subrecord is read from the right place. Only surplus is accepted: a DATA shorter than its counts throws as before, and a DATA whose length runs past the end of its record throws. The public GetListCounts keeps its signature and calls an internal overload that also returns where DATA ends. Writes are driven by the lists, so a re-save drops the surplus. Skyrim, Fallout 4 and Starfield share the same code and get the same change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Builds FSTS records from raw bytes and reads each through the direct parser and the overlay. Skyrim: zero counts with surplus DATA, with EDID before and after; a populated list with surplus, including surplus that is not a multiple of 4, followed by EDID; a short DATA that throws; a DATA length past the end of the record that throws; and a matching record that writes back byte-identical. The surplus cases also check that a write drops the surplus. Fallout 4 and Starfield each get a populated list with surplus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
A FootstepSet whose DATA is longer than 4 bytes per FormID counted in XCNT fails to parse with
DATA record had unexpected length that did not match previous counts, through both the direct parse and the overlay. The record that hit this, in Skyrim, has XCNT0, 0, 0, 0, 0and DATA00 00 00 00. xEdit sizes each DATA array from its XCNT count and shows the leftover bytes as unused data, and the game reads by the counts too, so both load it.The fix, applied alike to Skyrim, Fallout 4 and Starfield:
GetListCounts(IMutagenReadStream)keeps its signature. It calls an internal overload that also returns where DATA ends.Tests in
FootstepSetDataLengthTests, each read through the direct parser and the overlay. Skyrim: zero counts with surplus, a populated list with surplus (including surplus that is not a multiple of 4) followed by EDID, a short DATA that throws, a DATA length past the record end that throws, and a matching record that writes back byte-identical. Fallout 4 and Starfield: a populated list with surplus. The surplus tests fail ondev.Mutagen.Bethesda.UnitTestspasses onnet9.0andnet10.0. Passthrough tests against real game data were not run; could you run them on Skyrim, Fallout 4 and Starfield?I found this through houseCARL, a tool built on Mutagen, which could not read a Skyrim FootstepSet carrying surplus DATA bytes (Avick3110/houseCARL#1037).
🤖 Generated with Claude Code