changeset 13106:112f3576f12e jdk8u181-b11

8205491: adjust reflective access checks Reviewed-by: alanb, mchung, igerasim, rhalade, ahgross
author igerasim
date Fri, 22 Jun 2018 23:35:22 -0700
parents babc71f6c811
children 22e01e7c5c39
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	Wed Jun 20 17:44:40 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;