Fix crash when feature contains invalid UTF-8 data (#2693)
This commit is contained in:
@@ -156,11 +156,19 @@ SymbolLayout::SymbolLayout(const BucketParameters& parameters,
|
||||
} else if (textTransform == TextTransformType::Lowercase) {
|
||||
u8string = platform::lowercase(u8string);
|
||||
}
|
||||
|
||||
ft.formattedText->addTextSection(applyArabicShaping(util::convertUTF8ToUTF16(u8string)),
|
||||
section.fontScale ? *section.fontScale : 1.0,
|
||||
section.fontStack ? *section.fontStack : baseFontStack,
|
||||
section.textColor);
|
||||
try {
|
||||
ft.formattedText->addTextSection(applyArabicShaping(util::convertUTF8ToUTF16(u8string)),
|
||||
section.fontScale ? *section.fontScale : 1.0,
|
||||
section.fontStack ? *section.fontStack : baseFontStack,
|
||||
section.textColor);
|
||||
} catch (...) {
|
||||
mbgl::Log::Error(
|
||||
mbgl::Event::ParseTile,
|
||||
"Encountered section with invalid UTF-8 in tile, source: " + sourceLayer->getName() +
|
||||
" z: " + std::to_string(canonicalID.z) + " x: " + std::to_string(canonicalID.x) +
|
||||
" y: " + std::to_string(canonicalID.y));
|
||||
continue; // skip section
|
||||
}
|
||||
} else {
|
||||
layoutParameters.imageDependencies.emplace(section.image->id(), ImageType::Icon);
|
||||
ft.formattedText->addImageSection(section.image->id());
|
||||
|
||||
Reference in New Issue
Block a user