changeset 12768:0b218e675429

8180617: Null pointer dereference in InitializeNode::complete_stores Summary: Fixed a missing null check on the return value of InitializeNode::allocation() found by Parfait. Reviewed-by: zmajo
author thartmann
date Mon, 22 May 2017 09:16:46 +0200
parents 8f941bab493f
children 1f917785fbe7
files src/share/vm/opto/memnode.cpp
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/memnode.cpp	Mon May 22 09:14:10 2017 +0200
+++ b/src/share/vm/opto/memnode.cpp	Mon May 22 09:16:46 2017 +0200
@@ -3947,9 +3947,10 @@
     // if it is the last unused 4 bytes of an instance, forget about it
     intptr_t size_limit = phase->find_intptr_t_con(size_in_bytes, max_jint);
     if (zeroes_done + BytesPerLong >= size_limit) {
-      assert(allocation() != NULL, "");
-      if (allocation()->Opcode() == Op_Allocate) {
-        Node* klass_node = allocation()->in(AllocateNode::KlassNode);
+      AllocateNode* alloc = allocation();
+      assert(alloc != NULL, "must be present");
+      if (alloc != NULL && alloc->Opcode() == Op_Allocate) {
+        Node* klass_node = alloc->in(AllocateNode::KlassNode);
         ciKlass* k = phase->type(klass_node)->is_klassptr()->klass();
         if (zeroes_done == k->layout_helper())
           zeroes_done = size_limit;