Thu, 01 Jun 2017 23:19:47 -0700
8175345: Reported null pointer dereference defect groups
Summary: Added required explicit NULL checks
Reviewed-by: thartmann, kvn
1.1 --- a/src/share/vm/opto/callnode.cpp Thu Jun 01 20:42:49 2017 -0400 1.2 +++ b/src/share/vm/opto/callnode.cpp Thu Jun 01 23:19:47 2017 -0700 1.3 @@ -743,8 +743,8 @@ 1.4 } 1.5 // May modify (by reflection) if an boxing object is passed 1.6 // as argument or returned. 1.7 - if (returns_pointer() && (proj_out(TypeFunc::Parms) != NULL)) { 1.8 - Node* proj = proj_out(TypeFunc::Parms); 1.9 + Node* proj = returns_pointer() ? proj_out(TypeFunc::Parms) : NULL; 1.10 + if (proj != NULL) { 1.11 const TypeInstPtr* inst_t = phase->type(proj)->isa_instptr(); 1.12 if ((inst_t != NULL) && (!inst_t->klass_is_exact() || 1.13 (inst_t->klass() == boxing_klass))) {
2.1 --- a/src/share/vm/opto/ifnode.cpp Thu Jun 01 20:42:49 2017 -0400 2.2 +++ b/src/share/vm/opto/ifnode.cpp Thu Jun 01 23:19:47 2017 -0700 2.3 @@ -1081,8 +1081,9 @@ 2.4 // be skipped. For example, range check predicate has two checks 2.5 // for lower and upper bounds. 2.6 ProjNode* unc_proj = proj_out(1 - prev_dom->as_Proj()->_con)->as_Proj(); 2.7 - if (unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate)) 2.8 - prev_dom = idom; 2.9 + if ((unc_proj != NULL) && (unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate))) { 2.10 + prev_dom = idom; 2.11 + } 2.12 2.13 // Now walk the current IfNode's projections. 2.14 // Loop ends when 'this' has no more uses.
3.1 --- a/src/share/vm/opto/loopTransform.cpp Thu Jun 01 20:42:49 2017 -0400 3.2 +++ b/src/share/vm/opto/loopTransform.cpp Thu Jun 01 23:19:47 2017 -0700 3.3 @@ -2714,6 +2714,11 @@ 3.4 return false; 3.5 } 3.6 3.7 + Node* exit = head->loopexit()->proj_out(0); 3.8 + if (exit == NULL) { 3.9 + return false; 3.10 + } 3.11 + 3.12 #ifndef PRODUCT 3.13 if (TraceLoopOpts) { 3.14 tty->print("ArrayFill "); 3.15 @@ -2831,7 +2836,6 @@ 3.16 */ 3.17 3.18 // Redirect the old control and memory edges that are outside the loop. 3.19 - Node* exit = head->loopexit()->proj_out(0); 3.20 // Sometimes the memory phi of the head is used as the outgoing 3.21 // state of the loop. It's safe in this case to replace it with the 3.22 // result_mem.
4.1 --- a/src/share/vm/opto/stringopts.cpp Thu Jun 01 20:42:49 2017 -0400 4.2 +++ b/src/share/vm/opto/stringopts.cpp Thu Jun 01 23:19:47 2017 -0700 4.3 @@ -891,8 +891,9 @@ 4.4 ctrl_path.push(cn); 4.5 ctrl_path.push(cn->proj_out(0)); 4.6 ctrl_path.push(cn->proj_out(0)->unique_out()); 4.7 - if (cn->proj_out(0)->unique_out()->as_Catch()->proj_out(0) != NULL) { 4.8 - ctrl_path.push(cn->proj_out(0)->unique_out()->as_Catch()->proj_out(0)); 4.9 + Node* catchproj = cn->proj_out(0)->unique_out()->as_Catch()->proj_out(0); 4.10 + if (catchproj != NULL) { 4.11 + ctrl_path.push(catchproj); 4.12 } 4.13 } else { 4.14 ShouldNotReachHere();