bug introduced in tzcode2005c

Olson, Arthur David (NIH/NCI) olsona at dc37a.nci.nih.gov
Tue Aug 9 14:00:17 UTC 2005


The infinite loop is caused by my failure to check for overflow; here's a
proposed fix.

				--ado

------- localtime.c -------
*** /tmp/geta2299	Tue Aug  9 09:56:30 2005
--- /tmp/getb2299	Tue Aug  9 09:56:30 2005
***************
*** 5,11 ****
  
  #ifndef lint
  #ifndef NOID
! static char	elsieid[] = "@(#)localtime.c	7.95";
  #endif /* !defined NOID */
  #endif /* !defined lint */
  
--- 5,11 ----
  
  #ifndef lint
  #ifndef NOID
! static char	elsieid[] = "@(#)localtime.c	7.96";
  #endif /* !defined NOID */
  #endif /* !defined lint */
  
***************
*** 1616,1624 ****
--- 1616,1628 ----
  		if (dir != 0) {
  			if (t == lo) {
  				++t;
+ 				if (t <= lo)
+ 					return WRONG;
  				++lo;
  			} else if (t == hi) {
  				--t;
+ 				if (t >= hi)
+ 					return WRONG;
  				--hi;
  			}
  			if (lo > hi)



More information about the tz mailing list