From stdcxx-dev-return-5142-apmail-incubator-stdcxx-dev-archive=incubator.apache.org@incubator.apache.org Thu Sep 20 23:51:39 2007 Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 89094 invoked from network); 20 Sep 2007 23:51:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Sep 2007 23:51:39 -0000 Received: (qmail 87288 invoked by uid 500); 20 Sep 2007 23:51:30 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 87276 invoked by uid 500); 20 Sep 2007 23:51:30 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 87265 invoked by uid 99); 20 Sep 2007 23:51:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Sep 2007 16:51:30 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [208.30.140.160] (HELO moroha.quovadx.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Sep 2007 23:53:31 +0000 Received: from qxvcexch01.ad.quovadx.com ([192.168.170.59]) by moroha.quovadx.com (8.13.6/8.13.6) with ESMTP id l8KNopwZ007731 for ; Thu, 20 Sep 2007 23:50:51 GMT X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C7FBE1.1CDE00E5" Subject: RE: [PATCH] Add overflow checking to basic_string append and push_back Date: Thu, 20 Sep 2007 17:51:17 -0600 Message-ID: In-Reply-To: <46F2F9AE.3060201@roguewave.com> X-MS-Has-Attach: yes X-MS-TNEF-Correlator: Thread-Topic: [PATCH] Add overflow checking to basic_string append and push_back Thread-Index: Acf72TFW4CtrnzO1R6CK5mB+cb0/OQAATf+Q References: <46F2D039.5070508@roguewave.com> <46F2F9AE.3060201@roguewave.com> From: "Travis Vitek" To: X-Virus-Checked: Checked by ClamAV on apache.org ------_=_NextPart_001_01C7FBE1.1CDE00E5 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable =20 Martin Sebor wrote: > >Travis Vitek wrote: >> >> template >> class Xallocator >> { >> public: >> typedef unsigned char size_type; > >I suspect the problem might actually be here. Once you define >size_type to a type with a more generous range the test case >passes. I made this and a few other simplifying changes in >the attached program (it's also possible that I messed >something up in the process ;-) > [21.3.5.2 p4] Effects: Determines the effective length rlen of the string to append as the smaller of n and str.size() - pos. The function then throws length_error if size() >=3D npos - rlen. The append that I'm invoking is described to behave as if it had called that function. The attached test case shows that we are not following through on that requirement. > >I agree that this is at least a theoretical problem (I can't >quite imagine a practical use case for size_type being only >8 bits wide). It might be an interesting exercise to change >string (and the other containers) to work correctly even >with size_type this small so long as it doesn't pessimize >the common case in any way (i.e., I wouldn't be in favor >of introducing a whole bunch of layers of template >metaprogramming tricks to get this to work). > I can't imagine why you'd want size_type to be so small either, but the fact is that the library allows you to do it, and it lists requirements for the behavior. > >But back to your patch, unless it actually addresses this >problem, we still need a test case for the problem that it >does attempt to fix. > I agree. I was sure this was an actual problem. If it is deemed to not be an issue, then I'm happy to let it slide. > >Martin > > >Martin > > ------_=_NextPart_001_01C7FBE1.1CDE00E5--