8010500: [parfait] Possible null pointer dereference at hotspot/src/share/vm/opto/loopnode.hpp
authoradlertz
Wed, 26 Feb 2014 07:46:46 +0100
changeset 22919 4d686766ac23
parent 22918 1c22d2094420
child 22920 dd3a135fca38
child 22922 d3b370c35082
8010500: [parfait] Possible null pointer dereference at hotspot/src/share/vm/opto/loopnode.hpp Summary: Added NULL check for loopnode() in get_pre_loop_end() Reviewed-by: kvn, roland
hotspot/src/share/vm/opto/superword.cpp
--- a/hotspot/src/share/vm/opto/superword.cpp	Wed Feb 26 07:44:59 2014 +0100
+++ b/hotspot/src/share/vm/opto/superword.cpp	Wed Feb 26 07:46:46 2014 +0100
@@ -441,6 +441,7 @@
     return true;   // no induction variable
   }
   CountedLoopEndNode* pre_end = get_pre_loop_end(lp()->as_CountedLoop());
+  assert(pre_end != NULL, "we must have a correct pre-loop");
   assert(pre_end->stride_is_con(), "pre loop stride is constant");
   int preloop_stride = pre_end->stride_con();
 
@@ -1981,7 +1982,7 @@
   CountedLoopNode *main_head = lp()->as_CountedLoop();
   assert(main_head->is_main_loop(), "");
   CountedLoopEndNode* pre_end = get_pre_loop_end(main_head);
-  assert(pre_end != NULL, "");
+  assert(pre_end != NULL, "we must have a correct pre-loop");
   Node *pre_opaq1 = pre_end->limit();
   assert(pre_opaq1->Opcode() == Op_Opaque1, "");
   Opaque1Node *pre_opaq = (Opaque1Node*)pre_opaq1;
@@ -2145,7 +2146,8 @@
   if (!p_f->is_IfFalse()) return NULL;
   if (!p_f->in(0)->is_CountedLoopEnd()) return NULL;
   CountedLoopEndNode *pre_end = p_f->in(0)->as_CountedLoopEnd();
-  if (!pre_end->loopnode()->is_pre_loop()) return NULL;
+  CountedLoopNode* loop_node = pre_end->loopnode();
+  if (loop_node == NULL || !loop_node->is_pre_loop()) return NULL;
   return pre_end;
 }