By submitting this bug issue, you agree to the following.
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.
|
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
By submitting this bug issue, you agree to the following.
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
followerslist, 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
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