Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GameFinder.StoreHandlers.Steam.Services.AppManifestParser crashes with empty manifest #156

Closed
some1one opened this issue Oct 20, 2024 · 2 comments · Fixed by #157
Closed

Comments

@some1one
Copy link

Somehow i ended up with a steam game manifest that is empty so when the SteamHandler.FindAllGames is called, it crashes when it tries to parse that one.

For reference in case someone is interested, the game id was PUBG, which i've never installed and the date on the file was 2018 even though i only created that steam library folder in 2024.

I feel like the expected behavior should be to ignore an empty manifest.

ValveKeyValue.dll!ValveKeyValue.Deserialization.KeyValues1.KV1TextReader.FinalizeCurrentObject(bool explicit) Line 168
(KV1TextReader.cs:168)
ValveKeyValue.dll!ValveKeyValue.Deserialization.KeyValues1.KV1TextReader.FinalizeDocument() Line 190 (KV1TextReader.cs:190)
ValveKeyValue.dll!ValveKeyValue.Deserialization.KeyValues1.KV1TextReader.ReadObject() Line 72 (KV1TextReader.cs:72)
ValveKeyValue.dll!ValveKeyValue.KVSerializer.Deserialize(System.IO.Stream stream, ValveKeyValue.KVSerializerOptions options) Line 41 (KVSerializer.cs:41)
GameFinder.StoreHandlers.Steam.dll!GameFinder.StoreHandlers.Steam.Services.AppManifestParser.ParseManifestFile(NexusMods.Paths.AbsolutePath manifestPath) Line 40 (AppManifestParser.cs:40)
GameFinder.StoreHandlers.Steam.dll!GameFinder.StoreHandlers.Steam.SteamHandler.FindAllGames() Line 91 (SteamHandler.cs:91)
System.Linq.dll!System.Collections.Generic.LargeArrayBuilder<OneOf.OneOf<GameFinder.StoreHandlers.Steam.SteamGame, GameFinder.Common.ErrorMessage>>.AddRange(System.Collections.Generic.IEnumerable<OneOf.OneOf<GameFinder.StoreHandlers.Steam.SteamGame, GameFinder.Common.ErrorMessage>> items) Line 112 (LargeArrayBuilder.SpeedOpt.cs:112)
System.Linq.dll!System.Collections.Generic.EnumerableHelpers.ToArray<OneOf.OneOf<GameFinder.StoreHandlers.Steam.SteamGame, GameFinder.Common.ErrorMessage>>(System.Collections.Generic.IEnumerable<OneOf.OneOf<GameFinder.StoreHandlers.Steam.SteamGame, GameFinder.Common.ErrorMessage>> source) Line 84 (EnumerableHelpers.Linq.cs:84)
System.Linq.dll!System.Linq.Enumerable.ToArray<OneOf.OneOf<GameFinder.StoreHandlers.Steam.SteamGame, GameFinder.Common.ErrorMessage>>(System.Collections.Generic.IEnumerable<OneOf.OneOf<GameFinder.StoreHandlers.Steam.SteamGame, GameFinder.Common.ErrorMessage>> source) Line 17 (ToCollection.cs:17)
GameFinder.Common.dll!GameFinder.Common.Extensions.SplitResults<GameFinder.StoreHandlers.Steam.SteamGame>(System.Collections.Generic.IEnumerable<OneOf.OneOf<GameFinder.StoreHandlers.Steam.SteamGame, GameFinder.Common.ErrorMessage>> results) Line 27 (Extensions.cs:27)
GameFinder.Common.dll!GameFinder.Common.AHandler<GameFinder.StoreHandlers.Steam.SteamGame, GameFinder.StoreHandlers.Steam.Models.ValueTypes.AppId>.FindAllGamesById(out GameFinder.Common.ErrorMessage[] errors) Line 78 (AHandler.cs:78)
GameFinder.Common.dll!GameFinder.Common.AHandler<GameFinder.StoreHandlers.Steam.SteamGame, GameFinder.StoreHandlers.Steam.Models.ValueTypes.AppId>.FindOneGameById(GameFinder.StoreHandlers.Steam.Models.ValueTypes.AppId id, out GameFinder.Common.ErrorMessage[] errors) Line 94 (AHandler.cs:94)

@Nutzzz
Copy link
Contributor

Nutzzz commented Oct 22, 2024

I see Mutagen passed the buck to this library, but the crash is actually in a library further up the chain, ValveKeyValue. You might report it there as well.

That being said, I have lots of Steam games installed, and it looks like 8 of them have empty manifests. Using the GameFinder.Example program, for me these are each caught in the try-catch block of ParseManifestFile(), and execution continues to the next manifest file. This should be the case since at least v3.2.0 of GameFinder, and it looks like the latest release of Mutagen is using v4.2.4. What version of Mutagen are you using?

In any case, it might be a reasonable change to throw in a check for a 0-length stream prior to the KVSerializer.Create(), and return an error at that point rather than waiting to catch the exception. EDIT: I created pull request #157

@some1one
Copy link
Author

some1one commented Oct 23, 2024

interesting. i have been using nightly versions of mutagen so it should be up to date
GameFinder: 4.2.4.0
ValveKeyValue: 0.10.0.360

🤦 I had break on all exceptions on and never tried to continue. sorry for the trouble

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 a pull request may close this issue.

2 participants