notepad4 icon indicating copy to clipboard operation
notepad4 copied to clipboard

A strange exception occurs when inputting specific characters.

Open vhkj opened this issue 1 year ago • 11 comments

Exception details shows in the gif picture below.. When I use Chinese Larry Input method(双拼输入法) and type "#" then type "i" or "u" ( in Chinese larry Input method, "ch" replace "i" ,"sh" replace "u") , it happends. This bug will also be reproduced in the Release version

I can't find the position to fix it.

thsbug

vhkj avatar Mar 20 '24 03:03 vhkj

https://i.postimg.cc/ncJBW02t/thsbug.gif

vhkj avatar Mar 20 '24 03:03 vhkj

Reproduceable with SciTE (set ime.interaction=0), temporary workaround is using inline mode IME. image

Adding a breakpoint after case WM_IME_COMPOSITION: seems hide the bug.

zufuliu avatar Mar 20 '24 10:03 zufuliu

The crash is due to ImeOnDocumentFeed(), no crashes after comment out if (wParam == IMR_DOCUMENTFEED) block: https://github.com/zufuliu/notepad2/blob/9399a27265622ae8409761f549e29f6b9dde073a/scintilla/win32/ScintillaWin.cxx#L1925-L1933

zufuliu avatar Mar 20 '24 11:03 zufuliu

The crash is due to ImeOnDocumentFeed(), no crashes after comment out if (wParam == IMR_DOCUMENTFEED) block:

https://github.com/zufuliu/notepad2/blob/9399a27265622ae8409761f549e29f6b9dde073a/scintilla/win32/ScintillaWin.cxx#L1925-L1933

Nice. It seems to have little impact on normal use. By the way, I wanna know how you located the bug location, could you please give me some advice?

vhkj avatar Mar 20 '24 12:03 vhkj

Reported as https://sourceforge.net/p/scintilla/bugs/2433/, please use inline mode IME for now.

zufuliu avatar Mar 20 '24 12:03 zufuliu

By the way, I wanna know how you located the bug location, could you please give me some advice?

First, I guess its stack buffer overrun, then added some printf() inside IME codes, and run release version form command line (change following to #if 1 ). https://github.com/zufuliu/notepad2/blob/65ccf25dba933ce233793f0612910d0d7a56b0ca/src/Notepad2.c#L522-L530

zufuliu avatar Mar 20 '24 12:03 zufuliu

By the way, I wanna know how you located the bug location, could you please give me some advice?

First, I guess its stack buffer overrun, then added some printf() inside IME codes, and run release version form command line (change following to #if 1 ).

https://github.com/zufuliu/notepad2/blob/65ccf25dba933ce233793f0612910d0d7a56b0ca/src/Notepad2.c#L522-L530

Ok, thanks for u. I'll try it.

vhkj avatar Mar 20 '24 12:03 vhkj

Fixed by 339e3fa8805f7c9411bf6e6df8d295b91b5a72a5.

zufuliu avatar Mar 21 '24 10:03 zufuliu

Hi @maboroshin, can you check whether window mode IMR_DOCUMENTFEED (issue #127) still works after 339e3fa8805f7c9411bf6e6df8d295b91b5a72a5?

zufuliu avatar Mar 21 '24 10:03 zufuliu

Thanks. It has been functional since 339e3fa.

Test method used: https://github.com/zufuliu/notepad2/issues/127#issuecomment-1537366797

results:

  • Notepad3 RC3_6.24.309.1: failure, Returns all case 0.

  • Notepad2 #2307 065c63a: Successful, As previous above test case, text 1 and 3 were successful.
  • Notepad2 #2305 339e3fa: Successful, As previous above test case, text 1 and 3 were successful.
  • Notepad2 #2304 65ccf25: failure, Returns all case 0.
  • Notepad2 v4.24.03r5146 : failure, Returns all case 0.

  • Notepad2 v4.23.08r4950 : failure
  • Notepad2 v4.23.06r4862 : failure , released Jun 18, 2023.
  • Previous IMR_DOCUMENTFEED success appears to be May 2023.

maboroshin avatar Mar 25 '24 15:03 maboroshin

Good to know it works. Just a bit strange as git blame -L:ImeOnDocumentFeed ScintillaWin.cxx says IMR_DOCUMENTFEED was added in 72ef5d61d3b2958f9c441a8dbcad83ed96e6d426 (v4.23.06r4862), and no changes to the function until 65ccf25dba933ce233793f0612910d0d7a56b0ca and 339e3fa8805f7c9411bf6e6df8d295b91b5a72a5.

zufuliu avatar Mar 26 '24 12:03 zufuliu