This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

basic_string<>::reserve - patch


As suggested in one of previous messages I added the check:
__LENGTHERROR(__res_arg > max_size());
in reserve.
The attachment contains the patch.

1999-07-02  Ryszard Kabatek <kabatek@chemie.uni-halle.de>

        * bits/string.tcc: Check the __res_arg for a length error.


Ryszard Kabatek
Martin-Luther University Halle-Wittenberg, Department of Physical Chemistry
Geusaer Str. 88, 06217 Merseburg, Germany
Tel. +49 3461 46 2487 (2466) Fax. +49 3461 46 2129
Index: bits/string.tcc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/bits/string.tcc,v
retrieving revision 1.49
diff -c -2 -p -r1.49 string.tcc
*** string.tcc	1999/07/01 02:40:24	1.49
--- string.tcc	1999/07/02 08:45:50
*************** namespace std
*** 299,302 ****
--- 299,303 ----
        if (__res_arg > this->capacity() || _M_rep()->_M_state > 0)
          {
+ 	  __LENGTHERROR(__res_arg > max_size());
  	  allocator_type __a = get_allocator();
  	  _CharT* __tmp = _M_rep()->_M_clone(__a, __res_arg - this->size());

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]