changeset 7976:69fd15e0437d

7201070: Serialization to conform to protocol Reviewed-by: dmocek, ahgross, skoivu
author smarks
date Thu, 08 Nov 2012 15:41:01 -0800
parents 3069b91ff041
children 9097b6ec0ecd
files src/share/classes/java/io/ObjectInputStream.java
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/io/ObjectInputStream.java	Wed Nov 07 14:26:41 2012 +0000
+++ b/src/share/classes/java/io/ObjectInputStream.java	Thu Nov 08 15:41:01 2012 -0800
@@ -1752,6 +1752,12 @@
         ObjectStreamClass desc = readClassDesc(false);
         desc.checkDeserialize();
 
+        Class<?> cl = desc.forClass();
+        if (cl == String.class || cl == Class.class
+                || cl == ObjectStreamClass.class) {
+            throw new InvalidClassException("invalid class descriptor");
+        }
+
         Object obj;
         try {
             obj = desc.isInstantiable() ? desc.newInstance() : null;