Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331453 - unicode nonprintable / zero width space completely bricks editors
Summary: unicode nonprintable / zero width space completely bricks editors
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.7 M4   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 350988 358970 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-11-30 11:35 EST by Tobi Vollebregt CLA
Modified: 2016-12-19 16:10 EST (History)
4 users (show)

See Also:


Attachments
ArrayIndexOutOfBoundsException that appears in the error log (5.11 KB, text/plain)
2010-11-30 11:38 EST, Tobi Vollebregt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobi Vollebregt CLA 2010-11-30 11:35:57 EST
Build Identifier: M20100909-0800

Eclipse is completely bricked (rendering artifacts and/or hang and many errors in error log) by pasting the unicode character U+200B (zero width space) in a Java editor.

I will attach the stacktrace of the exception that is repeatedly put in the error log right after pasting this character in an Eclipse Java editor.

Curiously, with a plain text file only the exception is spammed in the error log, but Eclipse seems to continue running normally. Major problems occur in the Java editor (and other language-specific editors).

Reproducible: Always

Steps to Reproduce:
1. Open eclipse & open a Java file
2. Paste the unicode character U+200B (zero width space) in the editor. Assuming bugzilla and the webserver support unicode properly I have included this invisible characters between the two x's: x​x
3. Observe that the error log is spammed full of ArrayIndexOutOfBoundsException; rendering of the editor window breaks and often (when pasting multiple times) rendering of other parts of Eclipse break too and/or it hangs indefinitely.
Comment 1 Tobi Vollebregt CLA 2010-11-30 11:38:35 EST
Created attachment 184146 [details]
ArrayIndexOutOfBoundsException that appears in the error log
Comment 2 Tobi Vollebregt CLA 2010-11-30 11:42:11 EST
Details about the character copied from KCharSelect

Character: Non-printable U+200B
Name: ZERO WIDTH SPACE
Annotations and Cross References
Notes:
commonly abbreviated ZWSP
this character is intended for invisible word separation and for line break control; it has no width, but its presence between two characters does not prevent increased letter spacing in justification
General Character Properties
Block: General Punctuation
Unicode category: Other, Format
Various Useful Representations
UTF-8: 0xE2 0x80 0x8B
UTF-16: 0x200B
C octal escaped UTF-8: \342\200\213
XML decimal entity: ​
Comment 3 Felipe Heidrich CLA 2010-12-02 15:25:39 EST
I suspect this was fixed in Bug 308329/Bug 295513
Can you please verify if this problem happens on HEAD ?
Comment 4 Felipe Heidrich CLA 2010-12-02 15:46:18 EST
I see the problem:
	public static void main(String[] args) {
		Display display = new Display();
		TextLayout layout = new TextLayout(display);
		layout.setText("a\u200B");
		layout.setAscent(20);
		layout.setDescent(6);
		layout.setSegments(new int[] {0, layout.getText().length()});
		layout.getBounds();
	}
Comment 5 Tobi Vollebregt CLA 2010-12-03 07:08:39 EST
I tested with the nightly eclipse-SDK-N20101202-2000-linux-gtk; issue still occurs with it.

Build id: N20101202-2000
Comment 6 Felipe Heidrich CLA 2010-12-06 10:54:02 EST
Fixed in HEAD 
Please verify the fix later this week using M4. Thank you.
Comment 7 Tobi Vollebregt CLA 2010-12-20 05:15:56 EST
Verified; works fine in M4.
Comment 8 Felipe Heidrich CLA 2011-07-05 10:45:32 EDT
*** Bug 350988 has been marked as a duplicate of this bug. ***
Comment 9 Eric Williams CLA 2016-12-19 16:10:57 EST
*** Bug 358970 has been marked as a duplicate of this bug. ***