changeset 1821:76d2b2133614

8205491: adjust reflective access checks Reviewed-by: alanb, mchung, igerasim, rhalade, ahgross
author igerasim
date Tue, 26 Jun 2018 23:58:35 +0100
parents 81fa2439e257
children 01f51b57dc8b
files src/share/classes/java/io/ObjectStreamClass.java
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/io/ObjectStreamClass.java	Fri Jan 26 09:09:08 2018 -0800
+++ b/src/share/classes/java/io/ObjectStreamClass.java	Tue Jun 26 23:58:35 2018 +0100
@@ -1505,11 +1505,11 @@
             }
             return false;
         } else {
-            // accessible if the parent is public and any constructor
-            // is protected or public
-            if ((superCl.getModifiers() & Modifier.PUBLIC) == 0) {
+            // sanity check to ensure the parent is protected or public
+            if ((superCl.getModifiers() & (Modifier.PROTECTED | Modifier.PUBLIC)) == 0) {
                 return false;
             }
+            // accessible if any constructor is protected or public
             for (Constructor<?> ctor : superCl.getDeclaredConstructors()) {
                 if ((ctor.getModifiers() & (Modifier.PROTECTED | Modifier.PUBLIC)) != 0) {
                     return true;