Ensure we don't free metadata from under skeleton assemblies
When we create skeleton assembly references, we back them by temporary memory out of our ITemporaryStorage service. We used a ConditionalWeakTable to ensure that if the reference was held alive that the underlying memory wouldn't disappear. This was subtly incorrect. If you had a PE symbol from such a compilation, the compilation is not held alive, and the metadata reference could be freed but the metadata (which is held by the symbol) could still be held. This meant we'd free the memory too early and crash. The fix is simple: root the memory by the metadata object, not the metadata reference. Fixes #13243.
Showing
想要评论请 注册 或 登录