7201070: Serialization to conform to protocol
Reviewed-by: dmocek, ahgross, skoivu
--- a/jdk/src/share/classes/java/io/ObjectInputStream.java Wed Nov 07 14:26:41 2012 +0000
+++ b/jdk/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;