LibWasm: Fix reference-to-stack-local from {Memory,Table}Instance

Allocating a MemoryInstance or TableInstance from Store would result in
a reference to a stack allocated {Memory,Table}Type that would
immediately fall out of scope.

The MemoryInstance case was causing ASAN issues for a LibWeb based test
- I don't have a reproducer for TableInstance, but it looks like it
suffers from the exact same problem.
This commit is contained in:
Shannon Booth 2024-03-30 19:41:27 +01:00 committed by Andreas Kling
parent d725076c7f
commit 7abedd2fed

View file

@ -399,7 +399,7 @@ public:
private:
Vector<Optional<Reference>> m_elements;
TableType const& m_type;
TableType m_type;
};
class MemoryInstance {
@ -459,7 +459,7 @@ private:
{
}
MemoryType const& m_type;
MemoryType m_type;
size_t m_size { 0 };
ByteBuffer m_data;
};