-
Notifications
You must be signed in to change notification settings - Fork 122
Closed
Description
eprosima::fastcdr::FastBuffer is not copy or move safe. It does not implement nor delete the default copy constructor, copy assignment operator, move constructor, or move assignment operator. If any one of those is used with an allocated buffer then the internal buffer will be freed twice.
#include <utility>
#include "fastcdr/FastBuffer.h"
int main()
{
// Copy assignment
{
eprosima::fastcdr::FastBuffer buffer1;
// Uncommenting this line causes double free at scope exit
// buffer1.resize(1000);
eprosima::fastcdr::FastBuffer buffer2 = buffer1;
}
// Copy constructor
{
eprosima::fastcdr::FastBuffer buffer1;
// Uncommenting this line causes double free at scope exit
// buffer1.resize(1000);
eprosima::fastcdr::FastBuffer buffer2(buffer1);
}
// Move assignment
{
eprosima::fastcdr::FastBuffer buffer1;
// Uncommenting this line causes double free at scope exit
// buffer1.resize(1000);
eprosima::fastcdr::FastBuffer buffer2 = std::move(buffer1);
}
// Move constructor
{
eprosima::fastcdr::FastBuffer buffer1;
// Uncommenting this line causes double free at scope exit
// buffer1.resize(1000);
eprosima::fastcdr::FastBuffer buffer2(std::move(buffer1));
}
return 0;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels