Browse Source

Make sure we don't try to read a character out of bounds

pull/10725/head
Benedikt Stebner 3 years ago
parent
commit
2f6246c61d
  1. 2
      src/Skia/Avalonia.Skia/TextShaperImpl.cs
  2. 2
      src/Windows/Avalonia.Direct2D1/Media/TextShaperImpl.cs

2
src/Skia/Avalonia.Skia/TextShaperImpl.cs

@ -72,7 +72,7 @@ namespace Avalonia.Skia
var glyphOffset = GetGlyphOffset(glyphPositions, i, textScale);
if (textSpan[i] == '\t')
if (i < textSpan.Length && textSpan[i] == '\t')
{
glyphIndex = typeface.GetGlyph(' ');

2
src/Windows/Avalonia.Direct2D1/Media/TextShaperImpl.cs

@ -68,7 +68,7 @@ namespace Avalonia.Direct2D1.Media
var glyphOffset = GetGlyphOffset(glyphPositions, i, textScale);
if (textSpan[i] == '\t')
if (i < textSpan.Length && textSpan[i] == '\t')
{
glyphIndex = typeface.GetGlyph(' ');

Loading…
Cancel
Save