[Orxonox-commit 7121] r11738 - code/branches/Presentation_HS17_merge/src/modules/asteroidmining

landauf at orxonox.net landauf at orxonox.net
Sun Feb 11 23:31:59 CET 2018


Author: landauf
Date: 2018-02-11 23:31:58 +0100 (Sun, 11 Feb 2018)
New Revision: 11738

Modified:
   code/branches/Presentation_HS17_merge/src/modules/asteroidmining/AsteroidMinable.cc
Log:
[AsteroidMining_HS17] fixed two buffer overflows that caused random crashes

Modified: code/branches/Presentation_HS17_merge/src/modules/asteroidmining/AsteroidMinable.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/asteroidmining/AsteroidMinable.cc	2018-02-11 21:43:00 UTC (rev 11737)
+++ code/branches/Presentation_HS17_merge/src/modules/asteroidmining/AsteroidMinable.cc	2018-02-11 22:31:58 UTC (rev 11738)
@@ -278,10 +278,10 @@
         
         int z = 0;
         float dProbA = 1.0/(a*a + 3.0*a + 2.0); // one 'probability unit' for discrete ramp function. Gauss stuff. 
-        for(z = 0; z<=a; ++z){probDensity[z] = (z+1)*dProbA; } // rising part
+        for(z = 0; z<a; ++z){probDensity[z] = (z+1)*dProbA; } // rising part
 
         float dProbB = 1.0/(b*b +3.0*b + 2.0);
-        for(z = 0; z<b; ++z){probDensity[c-z] = (z+1)*dProbB;} // falling part
+        for(z = 0; z<b; ++z){probDensity[c-1-z] = (z+1)*dProbB;} // falling part
     
         // // Just for testing:
         // float sum = 0.0;



More information about the Orxonox-commit mailing list