libstdc++/8230: Buggy allocator behaviour
gdr@nerim.net
gdr@nerim.net
Tue Oct 15 05:56:00 GMT 2002
>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 ;
}
More information about the Gcc-bugs
mailing list