1
0

feat: finish dup mesh/mtl/tex check rule in BMapInspector

- also fix "use after free" issue in QuoteObjectNames.
This commit is contained in:
2026-03-02 12:30:02 +08:00
parent 1a36a8b6d7
commit d1f4a37097
4 changed files with 102 additions and 20 deletions

View File

@@ -164,10 +164,14 @@ namespace BMapInspector::Rule::Shared {
requires std::is_pointer_v<std::iter_value_t<InputIt>>
&& std::is_base_of_v<O::CKObject, std::remove_pointer_t<std::iter_value_t<InputIt>>>
std::u8string QuoteObjectNames(InputIt first, InputIt last) {
std::u8string cache;
return yycc::string::op::join(
[&first, &last]() -> std::optional<std::u8string_view> {
[&cache, &first, &last]() -> std::optional<std::u8string_view> {
if (first == last) return std::nullopt;
return QuoteObjectName(*(first++));
// YYC MARK:
// We must use "cache", otherwise "use after free" will occur.
cache = QuoteObjectName(*(first++));
return cache;
},
u8", ");
}