sledge
sledge copied to clipboard
GenericStructure.ParseStructure enters infinite loop on unexpected EOF
Sledge.Providers/GenericStructure.cs:635 - if reader doesn't have any more data, it returns null. String.IsNullOrWhiteSpace(null) is true, so the loop will never end. You could add something like:
if (line == null)
throw new WhateverException("EOF trying to parse generic structure");
For reference, materials/models/gibs/combine_helicopter_gibs/combine_helicopter02.vmt from Half-Life 2: Episode Two has an extra 's' in it.
This bug still exists in the new release, the new file location is SerialisedObjectFormatter.cs:122
This example code replicates the bug:
var invalid = "Invalid\n{\ns";
var ms = new MemoryStream(Encoding.ASCII.GetBytes(invalid));
var fmt = new SerialisedObjectFormatter();
fmt.Deserialize(ms).Dump();
The invalid VMT has since been patched in HL2 EP2.