Description

Crash when outputting garbled text when creating Android package. It did not occur in my colleague's environment using English OS, but occurred in my environment using Japanese OS. This issue should be fixed as soon as possible, as it occurs in many Japanese licensee environments.

This crash is caused by the following check in SlateTextShaper.cpp, but this check seems unnecessary. The reason is that some of the following code assumes TextStartIndex> TextEndIndex. Perhaps it's better to replace with if and warning output instead of check.

 

const int32 NumGlyphsRendered = OutGlyphsToRender.Num() - InitialNumGlyphsToRender;
if (NumGlyphsRendered > 0)
{
   auto ConditionalUpdateGlyphCountsForRange = [this, InTextStart](FShapedGlyphEntry& ShapedGlyphEntry, const int32 TextStartIndex, const int32 TextEndIndex)
   {
      check(TextStartIndex <= TextEndIndex);

      if (ShapedGlyphEntry.NumCharactersInGlyph == 0 && ShapedGlyphEntry.NumGraphemeClustersInGlyph == 0)
      {
         ShapedGlyphEntry.NumCharactersInGlyph = TextEndIndex - TextStartIndex;

         if (ShapedGlyphEntry.NumCharactersInGlyph > 0)

 

 

Steps to Reproduce

Minimal:
Copy the following text into any editable text in the editor: ڍׂ́

Original:
create an Android package on a Japanese OS

Callstack
  1. UE4Editor-SlateCore-Win64-Debug.dll!FSlateTextShaper::PerformHarfBuzzTextShaping::__l71::<ラムダ>(FShapedGlyphEntry & ShapedGlyphEntry, const int TextStartIndex, const int TextEndIndex) 行 689 C++
  2. UE4Editor-SlateCore-Win64-Debug.dll!FSlateTextShaper::PerformHarfBuzzTextShaping(const wchar_t * InText, const int InTextStart, const int InTextLen, const FSlateFontInfo & InFontInfo, const float InFontScale, const TextBiDi::ETextDirection InTextDirection, TArray<FShapedGlyphEntry,TSizedDefaultAllocator<32> > & OutGlyphsToRender) 行 779 C++
  3. UE4Editor-SlateCore-Win64-Debug.dll!FSlateTextShaper::PerformTextShaping(const wchar_t * InText, const int InTextStart, const int InTextLen, const FSlateFontInfo & InFontInfo, const float InFontScale, const TextBiDi::ETextDirection InTextDirection, const ETextShapingMethod TextShapingMethod, TArray<FShapedGlyphEntry,TSizedDefaultAllocator<32> > & OutGlyphsToRender) 行 238 C++
  4. UE4Editor-SlateCore-Win64-Debug.dll!FSlateTextShaper::ShapeBidirectionalText(const wchar_t * InText, const int InTextStart, const int InTextLen, const FSlateFontInfo & InFontInfo, const float InFontScale, const TextBiDi::ETextDirection InBaseDirection, const ETextShapingMethod TextShapingMethod) 行 113 C++
  5. UE4Editor-SlateCore-Win64-Debug.dll!FSlateFontCache::ShapeBidirectionalText(const wchar_t * InText, const int InTextStart, const int InTextLen, const FSlateFontInfo & InFontInfo, const float InFontScale, const TextBiDi::ETextDirection InBaseDirection, const ETextShapingMethod InTextShapingMethod) 行 966 C++
  6. UE4Editor-Slate-Win64-Debug.dll!FShapedTextCache::AddShapedText(const FCachedShapedTextKey & InKey, const wchar_t * InText) 行 29 C++
  7. UE4Editor-Slate-Win64-Debug.dll!FShapedTextCache::FindOrAddShapedText(const FCachedShapedTextKey & InKey, const wchar_t * InText) 行 76 C++
  8. UE4Editor-Slate-Win64-Debug.dll!ShapedTextCacheUtil::MeasureShapedText(const TSharedRef<FShapedTextCache,0> & InShapedTextCache, const FCachedShapedTextKey & InRunKey, const FTextRange & InMeasureRange, const wchar_t * InText) 行 103 C++
  9. UE4Editor-Slate-Win64-Debug.dll!FSlateTextRun::Measure(int BeginIndex, int EndIndex, float Scale, const FRunTextContext & TextContext) 行 59 C++
  10. UE4Editor-Slate-Win64-Debug.dll!FTextLayout::FRunModel::CreateBlock(const FTextLayout::FBlockDefinition & BlockDefine, float InScale, const FLayoutBlockTextContext & InTextContext) 行 2650 C++
  11. UE4Editor-Slate-Win64-Debug.dll!FTextLayout::CreateLineViewBlocks(int LineModelIndex, const int StopIndex, const float WrappedLineWidth, const TOptional<float> & JustificationWidth, int & OutRunIndex, int & OutRendererIndex, int & OutPreviousBlockEnd, TArray<TSharedRef<ILayoutBlock,0>,TSizedDefaultAllocator<32> > & OutSoftLine) 行 325 C++
  12. UE4Editor-Slate-Win64-Debug.dll!FTextLayout::FlowLineLayout(const int LineModelIndex, const float WrappingDrawWidth, TArray<TSharedRef<ILayoutBlock,0>,TSizedDefaultAllocator<32> > & SoftLine) 行 581 C++
  13. UE4Editor-Slate-Win64-Debug.dll!FTextLayout::AddLines(const TArray<FTextLayout::FNewLineData,TSizedDefaultAllocator<32> > & NewLines) 行 2171 C++
  14. UE4Editor-OutputLog-Win64-Debug.dll!FOutputLogTextLayoutMarshaller::AppendPendingMessagesToTextLayout() 行 746 C++
  15. UE4Editor-OutputLog-Win64-Debug.dll!FOutputLogTextLayoutMarshaller::SubmitPendingMessages() 行 681 C++
  16. UE4Editor-OutputLog-Win64-Debug.dll!SOutputLog::Tick(const FGeometry & AllottedGeometry, const double InCurrentTime, const float InDeltaTime) 行 981 C++
  17. UE4Editor-SlateCore-Win64-Debug.dll!SWidget::Paint(const FPaintArgs & Args, const FGeometry & AllottedGeometry, const FSlateRect & MyCullingRect, FSlateWindowElementList & OutDrawElements, int LayerId, const FWidgetStyle & InWidgetStyle, bool bParentEnabled) 行 1234 C++

Have Comments or More Details?

There's no existing public thread on this issue, so head over toAnswerHub just mention UE-91619 in the post.

1
Login to Vote

Fixed
ComponentTools - Slate
Affects Versions4.244.25
Target Fix4.25
Fix Commit12875935
Release Commit12875935
CreatedApr 7, 2020
ResolvedApr 17, 2020
UpdatedMay 5, 2020