Skip to content

KV3 Lib: unable to parse keys that have spaces in them #858

@RedMser

Description

@RedMser

Describe the bug

Note that I am using VRF as a library, not the Source2Viewer GUI.

This bug seems similar to #542 but this one is for reading KV3 data instead of writing.

If an object key has a space in it, parsing fails since ReadPropName searches for whitespace to end parsing, not taking into account that quoted strings may contain spaces.

Even if the spaces are removed, the quotes are also included in the resulting property name string.

Expected behavior

Parsing to complete without errors.

Relevant log output or exception with stacktrace

Exception has occurred: CLR/System.IO.InvalidDataException
An unhandled exception of type 'System.IO.InvalidDataException' occurred in ValveResourceFormat.dll: 'Unknown flag In"'
   at ValveResourceFormat.Serialization.KeyValues.KeyValues3.ReadValueFlagged(Char c, Parser parser) in /_/ValveResourceFormat/Serialization/KeyValues/KeyValues3.cs:line 446
   at ValveResourceFormat.Serialization.KeyValues.KeyValues3.ParseKVFile(Stream fileStream) in /_/ValveResourceFormat/Serialization/KeyValues/KeyValues3.cs:line 131

What game does this happen in

Deadlock

Reference file in a Source 2 game

Decompiled scripts/ping_wheel_messages.vdata_c contains strings like "Going In" as keys, which is correct as per #542 but does not parse properly by the lib's own parser.

What version of VRF are you using?

PackageReference Include="ValveResourceFormat" Version="10.2.3850"

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working correctly.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions