changeset 13246:de36499442b3

8205491: adjust reflective access checks Reviewed-by: alanb, mchung, igerasim, rhalade, ahgross
author igerasim
date Fri, 22 Jun 2018 23:35:22 -0700
parents ce4e64dd600b
children 30d18819c662
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	Thu Jun 21 10:08:03 2018 -0700
+++ b/src/share/classes/java/io/ObjectStreamClass.java	Fri Jun 22 23:35:22 2018 -0700
@@ -1534,11 +1534,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;