Jump to content

  •  

Bug Tracker Migration

June 3rd
Good news everyone! The staff has decided that it is time to slowly kill off this Bug Tracker. We will begin the process of slowly migrating from this Bug Tracker over to our Github Issues which can be found here: https://github.com/HerculesWS/Hercules/issues

Over the next couple of days, I will be closing off any opportunity to create new reports. However, I still will keep the opportunity to reply to existing Bug Reports. Doing this will allow us to slowly fix any bug reports we have listed here so that we can easily migrate over to our Issue Tracker.

Update - June 7th 2015: Creating new bug posts has been disabled. Please use our https://github.com/HerculesWS/Hercules/issues tracker to post bugs. Users are still able to reply to existing bug posts.

- Administration

Issue Information

Issue Confirmations

  • Yes (0)No (0)
Photo

skill_trap_splash nullpo error

Posted by Hercules Bot on 09 September 2010 - 03:36 AM

Originally posted by theultramage
http://www.eathena.w...er&showbug=4426

There exists an unintended scenario where skill_trap_splash() will execute on a skill unit that has no group (array of ground cells) associated with it. Since this is an unexpected event, the only thing handling it is a nullpo_retr() check - which will however get disabled in non-debug builds. The consequence is that the followup code will attempt to dereference a null pointer and crash the mapserver.

Here are the steps to reproduce (figured out thanks to digos):
  1. place trap-like skill unit on ground (hunter traps, fire pillar).
  2. have multiple mobs get killed by this trap at the same time.
  3. have the player warped to a different map by an OnDead event attached to each of these mobs.
Example script: Attached File  nullpo_foreach_splash_warp.txt ( 384bytes ) Number of downloads: 34

Now what happens is that the splash code will process mobs one by one. The first one will die and trigger the warp event. This will move the player to a different map, and doing so will wipe all land skills belonging to the player. Then the next mob will be processed for splash damage; however, the skill unit group is no longer there.

Since the same scenario ought to be happening with AoE skills like Stormgust, I checked skill_unit_timer_sub_onplace()... and from there copied the following lines:
CODE
static int skill_trap_splash (struct block_list *bl, va_list ap)
{
    ...

+    if( !unit->alive || bl->prev == NULL )
+        return 0;

    nullpo_retr(0, sg = unit->group);
    nullpo_retr(0, ss = map_id2bl(sg->src_id));


This post has been edited by theultramage: Sep 8 2010, 08:36 PM