From b2cf8c4cb05eac69cc1d758b6aa57f74b9deda97 Mon Sep 17 00:00:00 2001 From: Yumin Qi Date: Mon, 8 Oct 2012 16:48:52 -0700 Subject: [PATCH] 8000332: SA ClassDump throws exception after permgen removal In ClassWrite.writeFields(), fields count was mistakenly set to fields length which overflow the array index. Also removed a file which is leftover from 6879063 changeset. Reviewed-by: coleenp, sspitsyn --- .../classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java | 9 ++++----- hotspot/agent/src/share/native/sadis.c | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java index d7c9913da1b..954052703c8 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java @@ -354,15 +354,14 @@ public class ClassWriter implements /* imports */ ClassConstants } protected void writeFields() throws IOException { - U2Array fields = klass.getFields(); - final int length = (int) fields.length(); + final int javaFieldsCount = klass.getJavaFieldsCount(); // write number of fields - dos.writeShort((short) length); + dos.writeShort((short) javaFieldsCount); - if (DEBUG) debugMessage("number of fields = " + length); + if (DEBUG) debugMessage("number of fields = " + javaFieldsCount); - for (int index = 0; index < length; index++) { + for (int index = 0; index < javaFieldsCount; index++) { short accessFlags = klass.getFieldAccessFlags(index); dos.writeShort(accessFlags & (short) JVM_RECOGNIZED_FIELD_MODIFIERS); diff --git a/hotspot/agent/src/share/native/sadis.c b/hotspot/agent/src/share/native/sadis.c index 0a2ad68b8a3..06525deecf5 100644 --- a/hotspot/agent/src/share/native/sadis.c +++ b/hotspot/agent/src/share/native/sadis.c @@ -46,7 +46,7 @@ #else -#include +#include #include #include