Branch: Tag:

2007-01-03

2007-01-03 23:10:17 by Peter Bortas <zino@lysator.liu.se>

Don't dereference NULL when DEBUG_MY_TIME_INVERSE is define.

Rev: src/builtin_functions.c:1.559

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin_functions.c,v 1.558 2006/03/16 09:44:50 grubba Exp $ + || $Id: builtin_functions.c,v 1.559 2007/01/03 23:10:17 peter Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.558 2006/03/16 09:44:50 grubba Exp $"); + RCSID("$Id: builtin_functions.c,v 1.559 2007/01/03 23:10:17 peter Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"
4695: Inside #if defined (HAVE_GMTIME) || defined (HAVE_LOCALTIME)
   for (loop_cnt = 0; loop_cnt < 20; loop_cnt++, old_diff_ts = diff_ts) {    diff_ts = my_tm_diff(target_tm, current_tm = timefn(&current_ts));    +  if (!current_tm) {   #ifdef DEBUG_MY_TIME_INVERSE -  +  fprintf (stderr, "outside range for timefn().\n"); + #endif +  return 0; +  } + #ifdef DEBUG_MY_TIME_INVERSE +  else +  {    fprintf (stderr, "curr: y %d m %d d %d h %d m %d isdst %d\n",    current_tm->tm_year, current_tm->tm_mon, current_tm->tm_mday,    current_tm->tm_hour, current_tm->tm_min, current_tm->tm_isdst);    fprintf (stderr, "diff: %d\n", diff_ts); -  +  }   #endif    -  if (!current_tm) { - #ifdef DEBUG_MY_TIME_INVERSE -  fprintf (stderr, "outside range for timefn().\n"); - #endif -  return 0; -  } -  +     if (!diff_ts) {    /* Got a satisfactory time, but if target_tm has an opinion on    * DST we should check if we can return an alternative in the