Skip to content

[Sonic Frontiers] Converse: fix OOB reads, use-after-free and memory leak#264

Merged
hyperbx merged 12 commits into
hedge-dev:mainfrom
hyperbx:main
Jul 2, 2026
Merged

[Sonic Frontiers] Converse: fix OOB reads, use-after-free and memory leak#264
hyperbx merged 12 commits into
hedge-dev:mainfrom
hyperbx:main

Conversation

@hyperbx

@hyperbx hyperbx commented Jun 29, 2026

Copy link
Copy Markdown
Member

This PR addresses three critical issues in the hook initialised by the Converse library.

  1. The string redirector was storing the length of the string data as the character length, rather than the number of characters in the string. This could lead to out-of-bounds reads when the game copies the redirected string into the Converse buffer.
  2. The string redirector was freeing redirected strings before they were being used.
  3. The string redirector could possibly return null. If it did, a new blank string would be allocated, but also never freed.

This fix needs testing on Linux, as these issues were made more apparent there, but these flaws would also affect Windows too.

@hyperbx hyperbx changed the title [Sonic Frontiers] Converse: fix use-after-free and memory leak [Sonic Frontiers] Converse: fix OOB reads, use-after-free and memory leak Jun 29, 2026
@RagdollClash RagdollClash mentioned this pull request Jun 29, 2026
@RagdollClash

Copy link
Copy Markdown
Contributor

Fixes blank strings under Linux

image image

@Mefiresu

Copy link
Copy Markdown

Unfortunately still seems to crash with the Tutorial Skip code for me...

@hyperbx

hyperbx commented Jun 29, 2026

Copy link
Copy Markdown
Member Author

Unfortunately still seems to crash with the Tutorial Skip code for me...

I've been able to replicate this on Windows and it does appear to be a fault with the Converse library. Looking into it.

hyperbx added 2 commits June 29, 2026 22:38
…ring

The game copies the string using a fixed length, rather than using a terminator.
@hyperbx

hyperbx commented Jun 29, 2026

Copy link
Copy Markdown
Member Author

@Mefiresu Tutorial Skip should work now, please test again using the latest Converse.hmm in the PR.

@Mefiresu

Copy link
Copy Markdown

Looks to be behaving properly now, 5/5 runs with no crashes.
Thanks for the patch!

@hyperbx hyperbx requested a review from Sajidur78 June 30, 2026 06:06
@hyperbx hyperbx marked this pull request as draft June 30, 2026 20:40
@hyperbx hyperbx marked this pull request as ready for review June 30, 2026 20:49
@hyperbx hyperbx force-pushed the main branch 2 times, most recently from ee4d9b6 to 3f6baab Compare July 1, 2026 09:31
Co-authored-by: Sajid <sajidur78@gmail.com>

@Sajidur78 Sajidur78 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hyperbx hyperbx merged commit f195a54 into hedge-dev:main Jul 2, 2026
1 check passed
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.

4 participants