Branch: Tag:

2004-12-14

2004-12-14 15:04:57 by Martin Stjernholm <mast@lysator.liu.se>

Handle overflow better in my_time_inverse.

Rev: src/builtin_functions.c:1.548

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.547 2004/12/13 19:37:31 mast Exp $ + || $Id: builtin_functions.c,v 1.548 2004/12/14 15:04:57 mast Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.547 2004/12/13 19:37:31 mast Exp $"); + RCSID("$Id: builtin_functions.c,v 1.548 2004/12/14 15:04:57 mast Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"
4444: Inside #if defined (HAVE_GMTIME) || defined (HAVE_LOCALTIME)
   break;    }    +  if (INT_TYPE_ADD_OVERFLOW (current_ts, diff_ts)) { + #ifdef DEBUG_MY_TIME_INVERSE +  fprintf (stderr, "got overflow adding %ld and %ld\n", +  (long) current_ts, (long) diff_ts); + #endif +  return 0; +  }    current_ts += diff_ts;    }