seek to MetaDataOffset before reading FMetaData - #153
Conversation
|
closing because PR description is AI generated, and no issue was opened containing test assets to verify the issue and verify the fix. both of these things are mentioned in the pull request template: "If this pull request is intended to fix an existing issue, reference the existing GitHub issue number here or create a new issue and reference the new issue number here." and "Pull requests containing AI-generated code, text, documentation, or other AI-generated assets will not be reviewed." would request that an issue be created with a problematic asset attached that is fixed by your change here, so that the issue can be replicated and it can be independently verified that this PR fixes that issue, and that you open a new PR without AI generated text that references that new issue |
Pull Request
Description
UAsset.Read()seeks to the recorded offset before every section except the metadata block,which parses from wherever the previous section left the cursor. That works only while the two
coincide.
They diverge when a package has gatherable text:
ReadLocMetadataObject()reads a single int32and returns when it's zero, under-reading the record, so the block ends 4 bytes short of
MetaDataOffset, measured 3841 against 3845, and 5273 against 5277, on two uncooked UE5.8blueprints.
FMetaDatathen starts early on unrelated bytes and usually throwsInvalid FString length: 1946157056. Where the wrong offset happens to decode, it misparsessilently instead.
This doesn't fix that under-read, only stops it corrupting an unrelated section, which every
other section already avoids by seeking.
Over 439 uncooked UE5.8 packages, with this as the only change: 21 that previously threw now
load, and the rest parse byte-identically.
Type of change
Testing
No test included, because nothing in
TestAssets/reproduces it,TestEditorAssets/*isUE4.27 where
MetaDataOffsetis 0, andTestEditorUE5_7/Blueprints/*has no gatherable text. Afixture needs an uncooked package with
MetaDataOffset > 0andGatherableTextDataCount > 0whose loc metadata objects are all empty. Saving a blueprint that carries an FText literal, a
Text variable with a default value, say, out of a UE5.8 editor project should produce one: the
text is what generates the gatherable-text block, while the graph nodes supply the object
metadata.