[rkward-cvs] rkward/rkward/misc rkspinbox.cpp,1.2,1.3

Thomas Friedrichsmeier tfry at users.sourceforge.net
Wed Mar 22 18:41:27 UTC 2006


Update of /cvsroot/rkward/rkward/rkward/misc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10476

Modified Files:
	rkspinbox.cpp 
Log Message:
Prevent integer overflow in real-mode spinbox

Index: rkspinbox.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/misc/rkspinbox.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** rkspinbox.cpp	17 Mar 2006 15:18:38 -0000	1.2
--- rkspinbox.cpp	22 Mar 2006 18:41:25 -0000	1.3
***************
*** 67,71 ****
  	delete validator;
  	validator = new_validator;
! 	
  	setMinValue ((int) (min * divisor));
  	setMaxValue ((int) (max * divisor));
--- 67,78 ----
  	delete validator;
  	validator = new_validator;
! 
! 	int max_max = INT_MAX / divisor;
! 	int min_min = INT_MIN / divisor;
! 	if (max > max_max) max = max_max;
! 	if (max < min_min) max = min_min;
! 	if (min < min_min) min = min_min;
! 	if (min > max_max) min = max_max;
! 
  	setMinValue ((int) (min * divisor));
  	setMaxValue ((int) (max * divisor));





More information about the rkward-tracker mailing list