OMNeT++/OMNEST Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000091OMNeT++simulation kernelpublic2009-07-31 17:322009-08-03 12:07
Reporterkosi 
Assigned Toandras 
PrioritynormalSeveritytrivialReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.0 
Target VersionFixed in Version4.1 
Summary0000091: cArray::clear() does not check for NULL
DescriptionIn cArray, when you remove an object, the coresponding element of the array is set to NULL, but the clear method seems to assume that elements were only deleted from the end of the array. So if you create an array of at least two elements and delete an element other than the last you get a segfault:
cArray arr;
arr.add(new Message());
arr.add(new Message());
arr.remove(0);
arr.clear(); //segfault here

I've attached a fix for this problem which doesn't change the semantics of the
add/remove operators. Another possible fix is to have the remove method swap the current object with the last object, though probably some code would break.
TagsNo tags attached.
Attached Filesdiff file icon carray.diff [^] (327 bytes) 2009-07-31 17:32 [Show Content]

- Relationships

-  Notes
(0000165)
andras (administrator)
2009-08-03 12:07

Thank you for the fix!

- Issue History
Date Modified Username Field Change
2009-07-31 17:32 kosi New Issue
2009-07-31 17:32 kosi File Added: carray.diff
2009-08-03 12:07 andras Note Added: 0000165
2009-08-03 12:07 andras Status new => resolved
2009-08-03 12:07 andras Fixed in Version => 4.1
2009-08-03 12:07 andras Resolution open => fixed
2009-08-03 12:07 andras Assigned To => andras


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker