Issue information

Issue ID
#4011
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Jan 17, 2010 16:24
Last Post
Hercules Elf Bot
Apr 4, 2012 8:12
Confirmation
N/A

Hercules Elf Bot - Jan 17, 2010 16:24

Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=4011

In r8107 we gained this snippet of code:
CODE
        md.damage = 7*tstatus->vit*sstatus->int_*sstatus->int_ / (10*(tstatus->vit+sstatus->int_));
+       if (md.damage < 0 || md.damage > INT_MAX>>1)
+       //Overflow prevention, will anyone whine if I cap it to a few billion?
+       //Not capped to INT_MAX to give some room for further damage increase.
+            md.damage = INT_MAX>>1;

I got a report that if md.damage somehow gets below 0, the equation will turn it into 1 billion. Not healthy. I guess the patch assumed the values will stay unsigned. Once that stops being true (there are hints that it's possible to get negative stats even today?), this will need to be corrected.

Hercules Elf Bot - Mar 23, 2012 8:37

Originally posted by [b]Ind[/b]
was fixed in a previous eathena revision