This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Sizes when sizeof(value_type) == 1 (Was: Re: vector<> can...)
Paolo Carlini wrote:
You could easily ask the allocator whatever in the range [__old_size + 1,
2 * __old_size - 1], and instead you are asking exactly zero!
Or, even better, you should just throw length_error or something similar,
and not asking memory at all, since the allocator *cannot* have it (32768
bytes are already allocated). The current code, instead, segfaults/crashes,
since ask the allocator only a few bytes, and if the allocator returns the
memory, the code proceeds with __uninitialized_copy_a and so on, without
realizing that there is no memory availablr to proceed.
Paolo.