Ensure that BoxPrimitive only sees clean data...
...rather than forcing it to zero irrelevant bits itself.
Change-Id: Ibbd28db08b68fac84704a911a6f927f7d9343055
diff --git a/src/java_lang_reflect_Field.cc b/src/java_lang_reflect_Field.cc
index d1b40f3..b22212f 100644
--- a/src/java_lang_reflect_Field.cc
+++ b/src/java_lang_reflect_Field.cc
@@ -89,11 +89,11 @@
}
// Get the field's value, boxing if necessary.
- JValue value;
+ JValue value = { 0 };
if (!GetFieldValue(o, f, value, true)) {
return NULL;
}
- BoxPrimitive(env, FieldHelper(f).GetTypeAsPrimitiveType(), value);
+ BoxPrimitive(FieldHelper(f).GetTypeAsPrimitiveType(), value);
return AddLocalReference<jobject>(env, value.l);
}
@@ -106,7 +106,7 @@
}
// Read the value.
- JValue field_value;
+ JValue field_value = { 0 };
if (!GetFieldValue(o, f, field_value, false)) {
return JValue();
}
@@ -206,7 +206,7 @@
// Unbox the value, if necessary.
Object* boxed_value = Decode<Object*>(env, javaValue);
JValue unboxed_value;
- if (!UnboxPrimitive(env, boxed_value, FieldHelper(f).GetType(), unboxed_value, "field")) {
+ if (!UnboxPrimitive(boxed_value, FieldHelper(f).GetType(), unboxed_value, "field")) {
return;
}