Opened 9 years ago

Last modified 9 years ago

#9075 new Bugs

Devision by zero in boost/date_time/int_adapter.hpp

Reported by: Alexander Drichel <alexander.drichel@…> Owned by: az_sw_dude
Milestone: To Be Determined Component: date_time
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

line 347

339  /*! Provided for cases when automatic conversion from 
340   * 'int' to 'int_adapter' causes incorrect results. */
341  int_adapter operator/(const int rhs) const
342  {
343    if(is_special() && rhs != 0)
344    {
345      return mult_div_specials(rhs);
346    }
347    return int_adapter<int_type>(value_ / rhs);
348  }

rhs is not checked if is_special() returns false.

Change History (1)

comment:1 by Marshall Clow, 9 years ago

Note that just above this (on lines 358-362) there is:

      if(rhs != 0)
      {
        return mult_div_specials(rhs);
      }
      else { // let divide by zero blow itself up
        return int_adapter<int_type>(value_ % rhs.value_);

so I think that this is deliberate.

I don't know what *should* happen here.

Note: See TracTickets for help on using tickets.