This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
basic_string<>::reserve - patch
- To: Benjamin Kosnik <bkoz@cygnus.com>
- Subject: basic_string<>::reserve - patch
- From: Ryszard Kabatek <rysio@rumcajs.chemie.uni-halle.de>
- Date: Fri, 2 Jul 1999 10:56:27 +0200 (CEST)
- cc: libstdc++@sourceware.cygnus.com
- Reply-To: Ryszard Kabatek <kabatek@chemie.uni-halle.de>
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());