Skip to content

Show an error instead of crashing when shortcuts.vdf is corrupted #558

Closed

Description

@Arcitec

Spent a few hour going deep into BoilR and steam_shortcuts_util source code.

BoilR was hanging any time I tried to do an import, and was also instantly crashing with this every time I went to the Images tab. The crash was just telling me:

Message:  called `Result::unwrap()` on an `Err` value: Utf8Error { valid_up_to: 2, error_len: Some(1) }
Location: /home/johnny/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/steam_shortcuts_util-1.1.8/src/shortcuts_parser.rs:253

In the end, I went deep into your steam_shortcuts_util, made my own app that prints exactly what data is incorrect/unexpected, and that's when I noticed that my shortcuts.vdf was corrupt and contained a 0x01 (UTF-8) marker in front of the icon key, yet the value was random binary data, so the UTF-8 decoding failed.

That in turn took me down a rabbit hole, where I found that SGDBoop was writing corrupt data (random RAM bytes) to shortcuts.vdf icon field ever since the June 2026 release of SGDBoop.

Here's an image showing an example of the corruption:

SteamGridDB/SGDBoop#92 (comment)

That was finally fixed by someone else and me here:

First lesson: Code should always be written in Rust to avoid such nonsensical memory errors. 😜

Second lesson: BoilR should definitely catch parsing errors from steam_shortcuts_util and tell the user that their shortcuts.vdf is corrupt, instead of crashing with an unhandled error, or infinitely hanging when "importing" (it did both).

I also noted that the steam_shortcuts_util has a TODO about the unwrap at the crashing line. Hehe.

Activity

  1. Arcitec commented on Oct 2, 2026

    @Arcitec
    ContributorAuthor

    I would provide a corrupt shortcuts.vdf but I forgot to copy it before I had repaired it already.

    But the corruption is easy to replicate: Just go to the icon value in a hex editor and put random non-UTF8 bytes in it, to trigger the UTF8 parsing error in steam_shortcuts_util. Then let's see what can be done in BoilR to make corruption such as this more obvious to the user.

  2. PhilipK commented on Oct 2, 2026

    @PhilipK
    Owner

    Thanks for digging all the way down to the cause, and for the SGDBoop fix. The panic is the unwrap you found in steam_shortcuts_util. PhilipK/steam_shortcuts_util#6 turns it into an error that says the text is not valid UTF-8. It also makes the parser stop with that error, where a plain parse error would have ended the list early and returned only the shortcuts before the corrupt one.

    Once that is released, BoilR gets a follow-up so both interfaces show the message and refuse to import over a file they could not read. This issue stays open until then.

    BoilR maintenance agent (Claude) on behalf of @PhilipK

  3. Arcitec commented on Oct 2, 2026

    @Arcitec
    ContributorAuthor

    @PhilipK I read through #570. It looks like it now shows a user error if the file can't be read or if there's a parser error?

    And I guess PhilipK/steam_shortcuts_util#6 qualifies as parser errors that will be surfaced this way?

  4. PhilipK commented on Oct 2, 2026

    @PhilipK
    Owner

    Yes to both. Since #570, a file that can't be read or parsed stops the import with a message that names the file, and nothing is written. BoilR 1.11.0 uses steam_shortcuts_util 1.1.9, so invalid UTF-8 (PhilipK/steam_shortcuts_util#6) and an entry that can't be parsed (PhilipK/steam_shortcuts_util#7) both arrive as that kind of error, where 1.1.8 panicked on the first and returned a shortened list on the second.

    This shipped in BoilR 1.11.0, out now on GitHub and on Flathub (stable). Closing; please reopen if a damaged file still crashes or hangs it.

    BoilR maintenance agent (Claude) on behalf of @PhilipK

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions