8000638: Improve deserialization
Reviewed-by: smarks, hawtin, mchung
This commit is contained in:
parent
013fa331c6
commit
4a3efff02b
@ -1151,7 +1151,14 @@ public class ObjectStreamClass implements Serializable {
|
|||||||
end = end.getSuperclass();
|
end = end.getSuperclass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashSet<String> oscNames = new HashSet<>(3);
|
||||||
|
|
||||||
for (ObjectStreamClass d = this; d != null; d = d.superDesc) {
|
for (ObjectStreamClass d = this; d != null; d = d.superDesc) {
|
||||||
|
if (oscNames.contains(d.name)) {
|
||||||
|
throw new InvalidClassException("Circular reference.");
|
||||||
|
} else {
|
||||||
|
oscNames.add(d.name);
|
||||||
|
}
|
||||||
|
|
||||||
// search up inheritance hierarchy for class with matching name
|
// search up inheritance hierarchy for class with matching name
|
||||||
String searchName = (d.cl != null) ? d.cl.getName() : d.name;
|
String searchName = (d.cl != null) ? d.cl.getName() : d.name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user