提交 c76eb167 编写于 作者: V vinnie

6686215: Some mutables not defensively copied when deserializing...

6686215: Some mutables not defensively copied when deserializing java.security.CodeSource & Timestamp objects
Reviewed-by: mullan
上级 5479f8df
/* /*
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -578,7 +578,7 @@ public class CodeSource implements java.io.Serializable { ...@@ -578,7 +578,7 @@ public class CodeSource implements java.io.Serializable {
// Deserialize array of code signers (if any) // Deserialize array of code signers (if any)
try { try {
this.signers = (CodeSigner[])ois.readObject(); this.signers = ((CodeSigner[])ois.readObject()).clone();
} catch (IOException ioe) { } catch (IOException ioe) {
// no signers present // no signers present
} }
......
/* /*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -157,7 +157,8 @@ public final class Timestamp implements Serializable { ...@@ -157,7 +157,8 @@ public final class Timestamp implements Serializable {
// Explicitly reset hash code value to -1 // Explicitly reset hash code value to -1
private void readObject(ObjectInputStream ois) private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException { throws IOException, ClassNotFoundException {
ois.defaultReadObject(); ois.defaultReadObject();
myhash = -1; myhash = -1;
timestamp = new Date(timestamp.getTime());
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册