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

fix: use after free and uninitialized memory #1603

Merged
merged 3 commits into from
May 31, 2024

Conversation

EmosewaMC
Copy link
Collaborator

fixes errors spotted in valgrind when logging into the server

UnEquipItem works fine for sending a proxy, however PurgeProxies unfortunately deletes the item you are unequipping silently, causing a use after free when calling UnEquipScripts. For now i have moved UnEquipScripts call up so there is no use after free.

Initialized some structures and variables that were used uninitialized.
Checked packet length for incoming packets to ensure we're not reading garbage memory.

Tested that

  • I can login and load into Avant Gardens
  • Valgrind no longer reports use after free for the purged items
  • Valgrind no longer reports reading undefined memory when handling packets of too small of a size or when forwarding a packet to chat server
  • Valgrind no longer reports using of uninitialized memory when accessing Character fields
  • I can send receive (friend requests) and load my friends list (same for ignore lost)
  • I can login and leave and chat server is still notified of my absense

aronwk-aaron
aronwk-aaron previously approved these changes May 27, 2024
Its used in the if check too...
@EmosewaMC
Copy link
Collaborator Author

Tested that flying to a property no longer reports warnings

@aronwk-aaron aronwk-aaron merged commit 01086d0 into main May 31, 2024
4 checks passed
@EmosewaMC EmosewaMC deleted the undefined-beavior-fixes branch May 31, 2024 05:11
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.

3 participants