stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject Re: [PATCH] Add overflow checking to basic_string append and push_back
Date Thu, 20 Sep 2007 22:52:30 GMT
Travis Vitek wrote:
> Martin,
> I think that you are right in the case of push_back, or when the string
> to append is short. My last testcase didn't prove anything. This one
> does. If you use the current trunk, this prints '4 aaaa' to the console.
> i.e. appending 20 characters to a buffer with 240 should not get you 4,
> should it?
> template <class _TypeT>
> 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 ;-)


View raw message