This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

libstdc++/8230: Buggy allocator behaviour


>Number:         8230
>Category:       libstdc++
>Synopsis:       Buggy allocator behaviour
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 15 05:56:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     James Kanze
>Release:        all GCC releases.
>Organization:
>Environment:
Plateform independent, though the program below
displays the buggy behaviour on IA32.
>Description:
std:allocator<T>::allocate(n) does not check for possible 
overflow before "folding" sizeof(T) * n.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="jk.C"
Content-Disposition: inline; filename="jk.C"

#include <vector>
#include <iostream>

int main()
{
   static size_t const size = 1024 * 1024 * 1024 ;
   std::vector< int >  array ;
   try {
      array.reserve( size ) ;
   } catch ( std::exception const& error ) {
      std::cerr << "Error: " << error.what() << " (type = " <<
         typeid( error ).name() << ")\n" ;
      return 2 ;
   }
   return 0 ;
}


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