changeset 13007:03453e4301fc

6823565: Excessive use of HandleList class in de-serialization code causes OutOfMemory Reviewed-by: chegar, shade
author redestad
date Wed, 28 Oct 2015 12:35:54 +0100
parents 2e63fa2efdb1
children 71e43dd2e0b9
files src/java.base/share/classes/java/io/ObjectInputStream.java
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/io/ObjectInputStream.java	Tue Oct 27 20:06:02 2015 -0700
+++ b/src/java.base/share/classes/java/io/ObjectInputStream.java	Wed Oct 28 12:35:54 2015 +0100
@@ -3383,10 +3383,11 @@
          * Registers a dependency (in exception status) of one handle on
          * another.  The dependent handle must be "open" (i.e., assigned, but
          * not finished yet).  No action is taken if either dependent or target
-         * handle is NULL_HANDLE.
+         * handle is NULL_HANDLE. Additionally, no action is taken if the
+         * dependent and target are the same.
          */
         void markDependency(int dependent, int target) {
-            if (dependent == NULL_HANDLE || target == NULL_HANDLE) {
+            if (dependent == target || dependent == NULL_HANDLE || target == NULL_HANDLE) {
                 return;
             }
             switch (status[dependent]) {