Skip to content

seek to MetaDataOffset before reading FMetaData - #153

Open
yelvert wants to merge 1 commit into
atenfyr:masterfrom
yelvert:fix/seek-to-metadata-offset
Open

seek to MetaDataOffset before reading FMetaData#153
yelvert wants to merge 1 commit into
atenfyr:masterfrom
yelvert:fix/seek-to-metadata-offset

Conversation

@yelvert

@yelvert yelvert commented Aug 1, 2026

Copy link
Copy Markdown

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 int32
and 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.8
blueprints. FMetaData then starts early on unrelated bytes and usually throws
Invalid FString length: 1946157056. Where the wrong offset happens to decode, it misparses
silently 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

  • Bug fix (non-breaking change which fixes an issue)

Testing

No test included, because nothing in TestAssets/ reproduces it, TestEditorAssets/* is
UE4.27 where MetaDataOffset is 0, and TestEditorUE5_7/Blueprints/* has no gatherable text. A
fixture needs an uncooked package with MetaDataOffset > 0 and GatherableTextDataCount > 0
whose 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant