Преглед на файлове

Added proper bounds of INT_MIN to INT_MAX for hp/sp when being sent to/from status_damage/status_heal for negative values because of INT_MAX being (-INT_MIN - 1).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13955 54d463be-8e91-2dee-dedb-b68131a5f0ec
Paradox924X преди 16 години
родител
ревизия
fda1387f60
променени са 2 файла, в които са добавени 6 реда и са изтрити 4 реда
  1. 2 0
      Changelog-Trunk.txt
  2. 4 4
      src/map/status.c

+ 2 - 0
Changelog-Trunk.txt

@@ -3,6 +3,8 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+09/07/21
+	* Added proper bounds of INT_MIN to INT_MAX for hp/sp when being sent to/from status_damage/status_heal for negative values because of INT_MAX being (-INT_MIN - 1). [Paradox924X]
 09/07/17
 	* Dead branches no longer check for players' level. (bugreport:3378) [Inkfish]
 	* The Lovers Card won't teleport anyone on PVP/WoE/BG maps. (bugreport:3371) [Inkfish]

+ 4 - 4
src/map/status.c

@@ -637,12 +637,12 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
 		sp = 0; //Not a valid SP target.
 
 	if (hp < 0) { //Assume absorbed damage.
-		status_heal(target, -hp, 0, 1);
+		status_heal(target, cap_value(-hp, INT_MIN, INT_MAX), 0, 1);
 		hp = 0;
 	}
 
 	if (sp < 0) {
-		status_heal(target, 0, -sp, 1);
+		status_heal(target, 0, cap_value(-sp, INT_MIN, INT_MAX), 1);
 		sp = 0;
 	}
 
@@ -859,7 +859,7 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag)
 		sc = NULL;
 
 	if (hp < 0) {
-		status_damage(NULL, bl, -hp, 0, 0, 1);
+		status_damage(NULL, bl, cap_value(-hp, INT_MIN, INT_MAX), 0, 0, 1);
 		hp = 0;
 	}
 
@@ -872,7 +872,7 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag)
 	}
 
 	if(sp < 0) {
-		status_damage(NULL, bl, 0, -sp, 0, 1);
+		status_damage(NULL, bl, 0, cap_value(-sp, INT_MIN, INT_MAX), 0, 1);
 		sp = 0;
 	}