Mercurial > hg > openjdk > jdk6 > jdk
changeset 1764:e63c5790ed31
8190289: More refactoring for client deserialization cases
Reviewed-by: prr, azvegint, rhalade, skoivu
author | serb |
---|---|
date | Tue, 07 Nov 2017 09:22:18 -0800 |
parents | 0765375af7d0 |
children | 889245d55627 |
files | src/share/classes/java/awt/geom/Path2D.java src/share/classes/javax/swing/text/html/CSS.java |
diffstat | 2 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/java/awt/geom/Path2D.java Mon Sep 25 19:44:28 2017 +0530 +++ b/src/share/classes/java/awt/geom/Path2D.java Tue Nov 07 09:22:18 2017 -0800 @@ -25,13 +25,14 @@ package java.awt.geom; +import java.awt.Rectangle; import java.awt.Shape; -import java.awt.Rectangle; -import sun.awt.geom.Curve; import java.io.Serializable; import java.io.StreamCorruptedException; import java.util.Arrays; +import sun.awt.geom.Curve; + /** * The {@code Path2D} class provides a simple, yet flexible * shape which represents an arbitrary geometric path. @@ -2476,9 +2477,12 @@ throw new java.io.InvalidObjectException(iae.getMessage()); } - pointTypes = new byte[(nT < 0) ? INIT_SIZE : nT]; - if (nC < 0) { - nC = INIT_SIZE * 2; + // Accept the size from the stream only if it is less than INIT_SIZE + // otherwise the size will be based on the real data in the stream + pointTypes = new byte[(nT < 0 || nT > INIT_SIZE) ? INIT_SIZE : nT]; + final int initX2 = INIT_SIZE * 2; + if (nC < 0 || nC > initX2) { + nC = initX2; } if (storedbl) { ((Path2D.Double) this).doubleCoords = new double[nC];
--- a/src/share/classes/javax/swing/text/html/CSS.java Mon Sep 25 19:44:28 2017 +0530 +++ b/src/share/classes/javax/swing/text/html/CSS.java Tue Nov 07 09:22:18 2017 -0800 @@ -3215,7 +3215,7 @@ s.defaultReadObject(); // Reconstruct the hashtable. int numValues = s.readInt(); - valueConvertor = new Hashtable(Math.max(1, numValues)); + valueConvertor = new Hashtable(); while (numValues-- > 0) { Object key = s.readObject(); Object value = s.readObject();