Skip to content
This repository was archived by the owner on Dec 3, 2025. It is now read-only.
This repository was archived by the owner on Dec 3, 2025. It is now read-only.

Wine: When using winetricks' msftedit, passing text with certain characters to the RichTextBox causes an uncatchable SEHException #145

@FenPhoenix

Description

@FenPhoenix

Yeah, I was testing manually setting encoding, and I set Alcazar's readme.txt to "Unicode (1200)" (that would be UTF-16). That's supposed to simply result in visual garbage, but instead it caused a SEHException, uncatchable.

I did the crazy-ass thing where you tell it to catch it anyway, and the log was:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.RichTextBox.WndProc(Message& m)
   at AngelLoader.Forms.CustomControls.RichTextBoxCustom.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, Int32 wParam, Int32 lParam)
   at System.Windows.Forms.RichTextBox.UpdateMaxLength()
   at System.Windows.Forms.RichTextBox.StreamIn(Stream data, Int32 flags)
   at System.Windows.Forms.RichTextBox.StreamIn(String str, Int32 flags)
   at System.Windows.Forms.RichTextBox.set_Text(String value)
   at AngelLoader.Forms.CustomControls.RichTextBoxCustom.ChangeEncoding(Encoding encoding, Boolean suspendResume)

I don't see wtf sending EM_EXLIMITTEXT (what UpdateMaxLength does) would have to do with anything. Apparently it's crashing on that message though, but only when the text contains certain characters. winetricks' msftedit is apparently from like Windows 7 for some reason, so it's older and maybe it doesn't support Unicode 5.1+, but to just CRASH on an unknown Unicode char though?!

The char in question was 0x0D3D, "Malayalam Sign Avagraha" (https://www.compart.com/en/unicode/U+0D3D). There may be (must be, I guess) others, but I don't have all year to take like 2 and a half minutes each to test every single character under the sun.

This issue could potentially be really bad. Assuming the charset detector is accurate and there are no triggering characters in legitimate text, then it won't ever cause a problem in normal use. If the user manually chooses a wrong encoding (like "Unicode (1200)" for a UTF-8 file), they could possibly get a crash, but the new encoding selection won't be saved, so an app restart will fix it. However, if the charset detector is not guessing accurately and the text ends up with triggering chars, or if they're there legitimately, then we have a VERY BAD situation, which is that the user will not ever be able to select that FM because it will just crash when trying to load the readme.

This problem doesn't seem to occur on the wine-mono RichTextBox, but then wine-mono RichTextBox is complete crap-garbage that doesn't even show images.

So... yeah, till I can figure something out, this is a bit of a show-stopper. At the very least I won't really be able to tell people to use winetricks' msftedit till I can get something worked out.

Metadata

Metadata

Assignees

Labels

Linux/WineIssue with the app when run on Linux with Wine/Proton/whatever

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions