otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.55k stars 1.04k forks source link

[Revscriptsys]: Register Action/MoveEvent to AID/UID leads to crash of application #4748

Closed xmish closed 4 weeks ago

xmish commented 4 weeks ago

By submitting this bug issue, you agree to the following.

Does this bug crash tfs?

yes

Server Version

1.7 (Master)

Operation System

Windows

OS Description

10.0.19045.4412

Bug description

when try to register any Action/MoveEvent to action/unique ID, tfs crashes

Possible Pull Requests which are to blame

Steps to reproduce

  1. create new script
  2. register it for Action ID
  3. start server
  4. crashes at https://github.com/otland/forgottenserver/blob/7011488166d1b6a398a51fc56fe854702a69a160/src/actions.h#L74

Code to reproduce the issue:

local saw = Action()

function saw.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    return true
end

saw:aid(1234)
saw:register()

Actual Behavior

Server crashes: image Call stack: image

Expected Behavior

Action/MoveEvent can be registed to either action, unique & item ID ranges

Backtrace

No response

EvilHero90 commented 4 weeks ago

can you test #4750 and confirm that it works

xmish commented 4 weeks ago

@EvilHero90 #4750 Fixes that issue