changeset 49187:f7b73f9ae38f

8198252: Null pointer dereference in fold_compares_helper Summary: Added required null check with reported usage of filtered_int_type calls Reviewed-by: kvn, thartmann
author rraghavan
date Wed, 28 Feb 2018 23:23:35 -0800
parents b8bfadfacded
children e9ba8b40ca6f
files src/hotspot/share/opto/ifnode.cpp
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/opto/ifnode.cpp	Thu Mar 01 01:47:46 2018 +0100
+++ b/src/hotspot/share/opto/ifnode.cpp	Wed Feb 28 23:23:35 2018 -0800
@@ -897,7 +897,8 @@
   // Figure out which of the two tests sets the upper bound and which
   // sets the lower bound if any.
   Node* adjusted_lim = NULL;
-  if (hi_type->_lo > lo_type->_hi && hi_type->_hi == max_jint && lo_type->_lo == min_jint) {
+  if (lo_type != NULL && hi_type != NULL && hi_type->_lo > lo_type->_hi &&
+      hi_type->_hi == max_jint && lo_type->_lo == min_jint) {
     assert((dom_bool->_test.is_less() && !proj->_con) ||
            (dom_bool->_test.is_greater() && proj->_con), "incorrect test");
     // this test was canonicalized
@@ -937,7 +938,8 @@
         cond = BoolTest::lt;
       }
     }
-  } else if (lo_type->_lo > hi_type->_hi && lo_type->_hi == max_jint && hi_type->_lo == min_jint) {
+  } else if (lo_type != NULL && hi_type != NULL && lo_type->_lo > hi_type->_hi &&
+             lo_type->_hi == max_jint && hi_type->_lo == min_jint) {
 
     // this_bool = <
     //   dom_bool = < (proj = True) or dom_bool = >= (proj = False)