Changeset 15413 in project for chicken


Ignore:
Timestamp:
08/11/09 13:49:09 (10 years ago)
Author:
felix
Message:

decoding of encoded large integers could overflow on 64-bit platforms (#64)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/runtime.c

    r15321 r15413  
    24402440
    24412441  if(n <= (double)C_MOST_POSITIVE_FIXNUM
    2442      && n >= (double)C_MOST_NEGATIVE_FIXNUM && modf(n, &m) == 0.0)
     2442     && n >= (double)C_MOST_NEGATIVE_FIXNUM && modf(n, &m) == 0.0) {
    24432443    return C_fix(n);
     2444  }
    24442445
    24452446#ifndef C_SIXTY_FOUR
     
    91629163
    91639164  if(bits == C_FLONUM_TYPE) {
    9164     if(maybe_fixnum) val = C_number(ptr, C_strtod(*str, str));
     9165    if(maybe_fixnum) {
     9166      long ln;
     9167
     9168      errno = 0;
     9169      ln = strtol(*str, str, 10);
     9170
     9171      if(((ln == LONG_MAX || ln == LONG_MIN) && errno == ERANGE) || **str != '\0')
     9172        val = C_number(ptr, C_strtod(*str, str));
     9173      else val = C_fix(ln);
     9174    }
    91659175    else val = C_flonum(ptr, C_strtod(*str, str));
    91669176
Note: See TracChangeset for help on using the changeset viewer.