8180617: Null pointer dereference in InitializeNode::complete_stores

Mon, 22 May 2017 09:16:46 +0200

author
thartmann
date
Mon, 22 May 2017 09:16:46 +0200
changeset 8769
cef572e3f5a6
parent 8768
c648545660d7
child 8770
241128a2c3ce

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

src/share/vm/opto/memnode.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/opto/memnode.cpp	Mon May 22 09:14:10 2017 +0200
     1.2 +++ b/src/share/vm/opto/memnode.cpp	Mon May 22 09:16:46 2017 +0200
     1.3 @@ -4035,9 +4035,10 @@
     1.4      // if it is the last unused 4 bytes of an instance, forget about it
     1.5      intptr_t size_limit = phase->find_intptr_t_con(size_in_bytes, max_jint);
     1.6      if (zeroes_done + BytesPerLong >= size_limit) {
     1.7 -      assert(allocation() != NULL, "");
     1.8 -      if (allocation()->Opcode() == Op_Allocate) {
     1.9 -        Node* klass_node = allocation()->in(AllocateNode::KlassNode);
    1.10 +      AllocateNode* alloc = allocation();
    1.11 +      assert(alloc != NULL, "must be present");
    1.12 +      if (alloc != NULL && alloc->Opcode() == Op_Allocate) {
    1.13 +        Node* klass_node = alloc->in(AllocateNode::KlassNode);
    1.14          ciKlass* k = phase->type(klass_node)->is_klassptr()->klass();
    1.15          if (zeroes_done == k->layout_helper())
    1.16            zeroes_done = size_limit;

mercurial