Page MenuHomePhabricator

FlexArray memory heap-use-after-free
ActivePublic

Authored by mduminer on Dec 20 2019, 10:15 AM.
hpp file
#include "pawlib/flex_array.hpp"
#include <iostream>
#include <memory>
class Container
{
public:
Container();
private:
std::shared_ptr<FlexArray<std::shared_ptr<FlexArray<int>>>> array;
};
void test_flex_array();
cpp file
#include "sandbox/flex_array_test.hpp"
Container::Container()
{
array = std::make_shared<FlexArray<std::shared_ptr<FlexArray<int>>>>();
for (int i = 0; i < 20; ++i)
{
std::cout << "Preparing to push Inner # " << i << std::endl;
auto inner = std::make_shared<FlexArray<int>>();
array->push(inner);
}
}
void test_flex_array()
{
Container();
}