Skip to content

Fix the save loading bug that corrupts saves - #7

Open
JusticarProgramming wants to merge 1 commit into
OpenTS-Developers:mainfrom
JusticarProgramming:fix/save-version-load-string
Open

Fix the save loading bug that corrupts saves#7
JusticarProgramming wants to merge 1 commit into
OpenTS-Developers:mainfrom
JusticarProgramming:fix/save-version-load-string

Conversation

@JusticarProgramming

Copy link
Copy Markdown

Summary

SaveVersionInfo::Load_String assembles the version strings of save files written with the older one-stream-per-value layout. Its wide-character buffer was declared inside the read loop, so every character was written into a fresh, uninitialised buffer and the string was read back as garbage; once the index ran past the end of the buffer it was also written out of bounds.

The buffer now spans the whole read and the loop stops before the buffer ends, so the scenario description, player house, executable name, and player name load as their saved text.

Behaviour and compatibility

Bug fix.
Affected boundary: save files, reading the version strings from the older one-stream-per-value layout.

The save format itself is unchanged, so no migration is required and supports existing saves..

Validation

  • Configured with CMake 4.4.3, generator Visual Studio 17 2022, -A Win32; MSVC 19.44.35220, Windows SDK 10.0.26100.0.
  • Win32 Debug build: succeeded (GameD.exe).
  • Win32 Release build: succeeded (Game.exe).
  • CTest, Debug and Release: 1/1 passed (logstress).
  • One inherited warning remains (unit.cpp C5055), unrelated to this change; no new warnings from savever.cpp

Documentation

No change needed.

Checklist

  • The change is focused; unrelated mechanical cleanup is separate
  • Compatibility effects and any migration are explicit
  • Validation distinguishes what passed, failed, and was not run
  • No prohibited assets, binaries, SDKs, credentials, or generated output are included

@JusticarProgramming
JusticarProgramming force-pushed the fix/save-version-load-string branch from f885b1c to 5f48b74 Compare August 29, 2026 06:45
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 this pull request may close these issues.

1 participant