File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ static auto FindAndDiagnoseImplLookupCycle(
184184}
185185
186186struct InterfacesFromConstantId {
187- llvm::ArrayRef <SemIR::SpecificInterface> interfaces;
187+ llvm::SmallVector <SemIR::SpecificInterface> interfaces;
188188 SemIR::BuiltinConstraintMask builtin_constraint_mask;
189189 bool other_requirements;
190190};
@@ -211,9 +211,14 @@ static auto GetInterfacesFromConstantId(
211211 if (!identified_id.has_value ()) {
212212 return std::nullopt ;
213213 }
214- return {{.interfaces = context.identified_facet_types ()
215- .Get (identified_id)
216- .required_interfaces (),
214+ // TODO: IdentifiedFacetTypes are held in a RelationalValueStore which does
215+ // not protect against UAF through reallocation, so we must copy data out of
216+ // it.
217+ llvm::SmallVector<SemIR::SpecificInterface> interfaces (
218+ context.identified_facet_types ()
219+ .Get (identified_id)
220+ .required_interfaces ());
221+ return {{.interfaces = std::move (interfaces),
217222 .builtin_constraint_mask = facet_type_info.builtin_constraint_mask ,
218223 .other_requirements = facet_type_info.other_requirements }};
219224}
You can’t perform that action at this time.
0 commit comments