Skip to content

Exception loading an older model file with no strings  #1289

Closed
@eerhardt

Description

@eerhardt

When I changed our model format for the ComponentCatalog changes (#970), I refactored some model loading code incorrectly. There are some existing models that are breaking our validation checks:

The old code was doing:

if (header.FpStringTable == 0)
{
// No strings.
strings = null;
ex = null;
return true;

The new code now does:

if (header.FpStringTable == 0)
{
// No strings.
strings = null;
}

Notice that it doesn't return early in the new code. Lower in the method there are checks here:

Contracts.CheckDecode(header.FpTail == reader.FpCur() - fpMin);
ulong tail = reader.ReadUInt64();
Contracts.CheckDecode(tail == TailSignatureValue, "Corrupt model file tail");

These checks are now failing with older model files. They were never run in the old code when there were no strings, so we shouldn't be running them anymore when reading older model files.

/cc @yaeldekel

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions