-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
By submitting this bug issue, you agree to the following.
- This is a bug in the software that resides in this repository, and not a support matter (use https://otland.net/forums/support.16/ for support)
- This issue is reproducible without changes to the C++ code in this repository
- This bug has not been resolved in master branch
- There is no existing issue for this bug already
Does this bug crash tfs?
not sure
Server Version
1.7 (Master)
Operation System
all (listed below)
OS Description
No response
Bug description
Following creature can cause crash
Possible Pull Requests which are to blame
Steps to reproduce
I could not reproduce a crash but just removing or killing the creature following you and walking away could potentialy crash.
Actual Behavior
When a creature follows you, it is added to your followers list, which is updated every time you walk removing creatures that are too far from you. However, when the creature in the list is removed or killed, it is not removed from the list, causing a dangling pointer.
forgottenserver/src/creature.cpp
Lines 838 to 841 in c519cc6
| const Position& followerPosition = creature->getPosition(); | |
| uint16_t distance = position.getDistanceX(followerPosition) + | |
| position.getDistanceY(followerPosition); | |
| return distance >= Map::maxViewportX + Map::maxViewportY || |
I couldn't reproduce a crash, but the debugger reported corrupted positions on that line (e.g x=42678, y=39234, z=219), confirming that it's indeed a dangling pointer.
Expected Behavior
Not crash?
Backtrace
Metadata
Metadata
Assignees
Labels
Type
Projects
Status