DESCRIPTION

Bug 205678 - [Clipboard] Using x11vnc with clipboard transfer causes
eclipse to OOM

Short story: depending on the clipboard content Eclipse can misinterpret
native data received from clipboard, which at the end can cause
OutOfMemoryError. All clients of the ResourceTransfer API are affected.

Details: one of the known cases is caused by the clipboard data objects
delivered by x11vnc. Eclipse blindly assumes that the clipboard content
describes a bunch of selected "resources" (files) and tries to read the
clipboard data. The first four bytes of the clipboard content are taken
as integer value (which can be a positive or negative number up to
2^31). In the worst case this can lead to the creation of a very large
IResource array and so to the OutOfMemoryError.

Current code has no limits, but no one seriously would copy/paste or
drag/drop more then 1.000.000 resources: creating an *empty* array of
100.000.000 resources will cause OOME on 512 MB heap size (default for
shipped Eclipse packages), same with copy/paste of a *full* array of
10.000.000 elements.

The patch introduces a maximum limit for ResourceTransfer of 1.000.000
elements. In case the elements count exceed this limit, an error message
will be logged to the error log and the transfer operation will be
cancelled. JUnit test for the new limit is added too.

Change-Id: I872151018c9212dafe0487ed71beec3943c570e5
Signed-off-by: Jayvion Booth xxx@xxx.xxx

COMMENTS

author: Jayvion Booth
date: 2015-02-12 18:42:58.000000000

Uploaded patch set 9.

-------------------------------------
author: Brenden Conley
date: 2015-02-12 18:43:04.000000000

Patch Set 9:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/4511/

-------------------------------------
author: Brenden Conley
date: 2015-02-12 19:02:59.000000000

Patch Set 9: Verified+1

Build Successful 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/4511/ : SUCCESS

-------------------------------------
author: Jayvion Booth
date: 2015-02-15 14:34:35.000000000

Patch Set 10: Patch Set 9 was rebased

-------------------------------------
