Bug 14176 - standard allocator crashes when deallocating segment of zero length.
Summary: standard allocator crashes when deallocating segment of zero length.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.2
: P2 minor
Target Milestone: 3.3.4
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-17 14:14 UTC by Hans de Nivelle
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.0
Known to fail: 2.95.3 3.0.4 3.2.2 3.2.3 3.3.1
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hans de Nivelle 2004-02-17 14:14:55 UTC
Hello,

I am not certain what the standard says about this, but the following code
causes a segmentation fault under various versions of g++ .
It is a bit strange off course to allocate segments of length 0, but
for symmetry it makes sense to allow it.

yours,
Hans.


#include <memory>

int main( int argc, char * argv[] )
{

   unsigned int len = 0;

   std::allocator< int > a;
   int* p = a. allocate( len );
   a. deallocate( p, len );

};
Comment 1 Benjamin Kosnik 2004-03-18 20:46:38 UTC
This is fixed in 3.4.0, and a testsuite added to prevent it from resurfacing.
Comment 2 Steven Bosscher 2004-03-20 11:17:44 UTC
Fixed in 3.4.0 according to Benjamin Kosnik, so I'm closing it.