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

savegame: initialise gym only when present #900

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

lahm86
Copy link
Collaborator

@lahm86 lahm86 commented Jul 24, 2023

Resolves #899.

Checklist

  • I have read the coding conventions
  • I have added a changelog entry about what my pull request accomplishes, or it is an internal change

Description

The error message stemmed from the following line when it was being called against the legacy "Current Position" level object. During shutdown, it had injections.length value of 1 despite this being 0 when the gameflow was initially loaded, so it was trying to free a null injection path.

https://github.com/LostArtefacts/Tomb1Main/blob/develop/src/game/gameflow.c#L1018

In savegame.c, the negative index in the initialisation just so happened to mean that the address of the length value above was being accessed, so it was changing from 0 to 1 here. This probably went unnoticed in pre-injection versions as it was most likely not changing anything that incurred memory management like we have in this situation.

This is the only place where g_GameFlow.gym_level_num is used as an array index.

@lahm86 lahm86 added the TRX bug A bug with TRX label Jul 24, 2023
@lahm86 lahm86 added this to the 2.16 milestone Jul 24, 2023
@lahm86 lahm86 self-assigned this Jul 24, 2023
@lahm86 lahm86 requested review from rr- and walkawayy July 24, 2023 19:37
Copy link
Collaborator

@walkawayy walkawayy left a comment

Choose a reason for hiding this comment

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

Ah nice find. LGTM.

Copy link
Collaborator

@rr- rr- left a comment

Choose a reason for hiding this comment

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

Do we need to get this released as a hotfix?

@lahm86 lahm86 merged commit df62ced into LostArtefacts:develop Jul 26, 2023
1 check passed
@lahm86 lahm86 deleted the issue-899-gym-initialisation branch July 29, 2023 10:46
@rr- rr- added the TR1 label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TR1 TRX bug A bug with TRX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

T1M bug: assertion error when gym level is not present
3 participants