This is the mail archive of the libstdc++@gcc.gnu.org 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]
Other format: [Raw text]

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.


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