chiark / gitweb /
Fixing Integer Overflow in nlopt_srand_time
authorMmanu Chaturvedi <mmanu.chaturvedi@kitware.com>
Mon, 17 Jul 2017 15:38:30 +0000 (11:38 -0400)
committerMmanu Chaturvedi <mmanu.chaturvedi@kitware.com>
Mon, 17 Jul 2017 15:38:30 +0000 (11:38 -0400)
api/general.c

index 26af0d3b2576c2c4a6edd0cb59a57a3092f47d1e..672163d4e6899e897c49233fa5b9085e0111ec80 100644 (file)
@@ -119,7 +119,7 @@ void NLOPT_STDCALL nlopt_srand(unsigned long seed) {
 }
 
 void NLOPT_STDCALL nlopt_srand_time(void) {
-     nlopt_srand(nlopt_time_seed() + my_gettid() * 314159);
+     nlopt_srand(nlopt_time_seed() + (unsigned long)my_gettid() * 314159);
 }
 
 void nlopt_srand_time_default(void) {