dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
7.02k stars 1.16k forks source link

WPF apps crash if they display text with too many combining marks #244

Open 0xd4d opened 5 years ago

0xd4d commented 5 years ago

If there are too many combining marks or other special chars on one line and you try to show this text in a WPF textbox or WPF text editor, the application crashes.

Actual behavior:

Crash

Expected behavior:

The extra special chars are either ignored or a .NET exception is thrown.

Minimal repro:

Paste this text in a WPF textbox or a WPF text editor (it's new string ('\u0483', 550))

҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃҃

Here's code that generates it, don't try to display it in the VS C# REPL, it will crash VS:

File.WriteAllLines(@"c:\some\dir\a.txt", new[] {new string ('\u0483', 550) })
vatsan-madhavan commented 5 years ago

@miguep, would you mind taking a look?

miguep commented 5 years ago

I'll give it a look

lindexi commented 5 years ago

The demo

<Grid>
    <TextBox x:Name="Txt"></TextBox>
</Grid>

    public MainWindow()
    {
        InitializeComponent();
        Txt.Text = new string('\u0483', 550);
    }
be5invis commented 5 years ago

image Doesn't look like a DWRITE issue.

lindexi commented 5 years ago

One good news is it can not break the UWP application. See https://github.com/Microsoft/microsoft-ui-xaml/issues/194