Re: [Boost-bugs] [Boost C++ Libraries] #4635: segmentation fault in text_oarchive::save_binary()

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4635: segmentation fault in text_oarchive::save_binary()
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-03-21 06:39:54


#4635: segmentation fault in text_oarchive::save_binary()
---------------------------------------------+------------------------------
  Reporter: Mark Heuser <mlheuser@…> | Owner: ramey
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: serialization
   Version: Boost 1.43.0 | Severity: Problem
Resolution: | Keywords:
---------------------------------------------+------------------------------

Comment (by Aliaksei Plashchanski <alekseyploschanskiy@…>):

 I met the same issue, i debugged and found that problem is in
 implementation base64_from_binary. Access violation appears in file
 transform_width.hpp.
 When iterator points to the last valid byte (addr+len-1) and algorithm
 need one more byte to complete missing bits - it increments iterator and
 read after buffer.

 {{{
 template<class Base, int BitsOut, int BitsIn, class CharType>
 CharType transform_width<Base, BitsOut, BitsIn, CharType>::fill(){
     CharType retval = 0;
     unsigned int missing_bits = BitsOut;
     for(;;){
         unsigned int bcount;
         if(! m_bufferfull){
             m_buffer = * this->base_reference(); !!! access to byte
 *(addr+len)
             m_bufferfull = true;
             bcount = BitsIn;
         }
         else
             bcount = BitsIn - m_displacement;
         unsigned int i = (std::min)(bcount, missing_bits);
         // shift interesting bits to least significant position
         unsigned int j = m_buffer >> (bcount - i);
         // strip off uninteresting bits
         // (note presumption of two's complement arithmetic)
         j &= ~(-(1 << i));
         // append then interesting bits to the output value
         retval <<= i;
         retval |= j;
         missing_bits -= i;
         if(0 == missing_bits)
             break;
         // note: suspect that this is not invoked for borland 5.51
         ++(this->base_reference());
         m_bufferfull = false;
     }
     return retval;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4635#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC