changeset 8717:07d37d29e3da

8079825: Uninitialised variable in hotspot/src/share/vm & cpu/x86/vm (runtime) Summary: initialized local variables in classFileParser.cpp and rframe.cpp Reviewed-by: dholmes, minqi
author ccheung
date Fri, 17 Jul 2015 12:07:49 -0700
parents 8ce83b99be19
children 67c4a62090e5 5c80bd3aab91
files src/share/vm/classfile/classFileParser.cpp src/share/vm/runtime/rframe.cpp
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/classFileParser.cpp	Thu Jul 16 15:01:12 2015 +0200
+++ b/src/share/vm/classfile/classFileParser.cpp	Fri Jul 17 12:07:49 2015 -0700
@@ -2023,10 +2023,10 @@
   bool lvt_allocated = false;
   u2 max_lvt_cnt = INITIAL_MAX_LVT_NUMBER;
   u2 max_lvtt_cnt = INITIAL_MAX_LVT_NUMBER;
-  u2* localvariable_table_length;
-  u2** localvariable_table_start;
-  u2* localvariable_type_table_length;
-  u2** localvariable_type_table_start;
+  u2* localvariable_table_length = NULL;
+  u2** localvariable_table_start = NULL;
+  u2* localvariable_type_table_length = NULL;
+  u2** localvariable_type_table_start = NULL;
   int method_parameters_length = -1;
   u1* method_parameters_data = NULL;
   bool method_parameters_seen = false;
--- a/src/share/vm/runtime/rframe.cpp	Thu Jul 16 15:01:12 2015 +0200
+++ b/src/share/vm/runtime/rframe.cpp	Fri Jul 17 12:07:49 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -81,7 +81,7 @@
 : InterpretedRFrame(fr, thread, callee) {}
 
 RFrame* RFrame::new_RFrame(frame fr, JavaThread* thread, RFrame*const  callee) {
-  RFrame* rf;
+  RFrame* rf = NULL;
   int dist = callee ? callee->distance() : -1;
   if (fr.is_interpreted_frame()) {
     rf = new InterpretedRFrame(fr, thread, callee);
@@ -93,8 +93,10 @@
   } else {
     assert(false, "Unhandled frame type");
   }
-  rf->set_distance(dist);
-  rf->init();
+  if (rf != NULL) {
+    rf->set_distance(dist);
+    rf->init();
+  }
   return rf;
 }