otland / forgottenserver

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

CONDITION_DRUNK crash in registerMonsterType #4102

Closed Zbizu closed 5 months ago

Zbizu commented 2 years ago

Steps to reproduce

  1. create a lua monster with attack involving condition drunk, for example {name ="drunk", interval = 2000, chance = 100, effect = CONST_ME_STUN, shootEffect = CONST_ANI_BURSTARROW, radius = 3, range = 4, target = true},
  2. start a server
  3. summon that monster
  4. do /reload scripts multiple times

Expected behaviour

lua error?

Actual behaviour

server crash reproduction rate is roughly 50% for reload and roughly 15-20% for startup exact line that leads to crashing: https://github.com/otland/forgottenserver/blob/a8e5007a4c577a1c5f7e9e47f04e5b3a2e6e5a06/src/actions.cpp#L35

Environment

master branch at c506a2f (most recent commit) no idea how long this was bugged, might be related to https://github.com/otland/forgottenserver/issues/3692 due to the fact that both are crashing in actions interface

Zbizu commented 2 years ago

alright, the crashes started from commit 1a5e3b1 (for testers: the client version is 10.98 on that commit)