public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/31370]  New: resizing bugs in std::vector
@ 2007-03-27  3:03 gcc at severeweblint dot org
  2007-03-27  3:09 ` [Bug libstdc++/31370] " gcc at severeweblint dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gcc at severeweblint dot org @ 2007-03-27  3:03 UTC (permalink / raw)
  To: gcc-bugs

Pre-4.0, vector had a bunch of nasty error cases when resizing overflowed a
size_t. Change 89377 fixed some of them. But

1) vector<bool>'s copy (yuck) of the relevant functions weren't updated

2) vector<bool>'s max_size is incorrect. currently it is set to the maximum
size_t. but because vector<bool>'s iterators aren't directly pointers, and the
iterator arithmetic takes ssize_t as arguments, it can't tolerate sizes that
don't fit in an ssize_t. because of the round up to the nearest word, the
correct max_size is SIZE_MAX rounded down to the nearest word.

3) if doubling a vector size exceeds max_size, the code will go ahead and ask
the allocator for it. It seems nicer to clamp the size to max_size, although a
bad_alloc is to be expected either way. I'd mostly argue that the vector code
should clamp at max_size to avoid relying on the allocator to range check
properly.


-- 
           Summary: resizing bugs in std::vector
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc at severeweblint dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31370


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-04-02 10:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-27  3:03 [Bug libstdc++/31370] New: resizing bugs in std::vector gcc at severeweblint dot org
2007-03-27  3:09 ` [Bug libstdc++/31370] " gcc at severeweblint dot org
2007-03-27  3:20 ` gcc at severeweblint dot org
2007-03-27  6:05 ` [Bug libstdc++/31370] resizing bugs in std::vector<bool> pinskia at gcc dot gnu dot org
2007-03-27  7:52 ` fang at csl dot cornell dot edu
2007-03-27  8:07 ` pcarlini at suse dot de
2007-03-27 19:27 ` gcc at severeweblint dot org
2007-03-27 20:03 ` pcarlini at suse dot de
2007-03-31 16:52 ` pcarlini at suse dot de
2007-04-02 10:16 ` paolo at gcc dot gnu dot org
2007-04-02 10:19 ` pcarlini at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).