From b543a74a7f47b5075b130a4091fbdd133ad5b2b2 Mon Sep 17 00:00:00 2001 From: dkimitsa Date: Tue, 19 Apr 2022 17:22:03 +0300 Subject: [PATCH] * fixed: debugger crash if method/field contains non ansi characters in name root case: str.length() != str.getBytes().length * also fixed CompositeDataBuffer readLong being wrongly proxied --- .../debuginfo/DebuggerDebugObjectFileInfo.java | 10 +++++++--- .../debugger/utils/bytebuffer/CompositeDataBuffer.java | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/debugger/src/main/java/org/robovm/debugger/debuginfo/DebuggerDebugObjectFileInfo.java b/plugins/debugger/src/main/java/org/robovm/debugger/debuginfo/DebuggerDebugObjectFileInfo.java index d354f1da7..d7a1102d4 100644 --- a/plugins/debugger/src/main/java/org/robovm/debugger/debuginfo/DebuggerDebugObjectFileInfo.java +++ b/plugins/debugger/src/main/java/org/robovm/debugger/debuginfo/DebuggerDebugObjectFileInfo.java @@ -245,9 +245,13 @@ public static void dumpDebugInfoAsText(RawData debugInfo, File file) { // } private static void putStringWithLen(DataOutputStream stream, String str) throws IOException { - stream.writeInt(str.length()); - if (!str.isEmpty()) - stream.write(str.getBytes()); + if (!str.isEmpty()) { + byte[] bytes = str.getBytes(); + stream.writeInt(bytes.length); + stream.write(bytes); + } else { + stream.writeInt(0); + } } } \ No newline at end of file diff --git a/plugins/debugger/src/main/java/org/robovm/debugger/utils/bytebuffer/CompositeDataBuffer.java b/plugins/debugger/src/main/java/org/robovm/debugger/utils/bytebuffer/CompositeDataBuffer.java index 9d2eab93c..370ff446c 100644 --- a/plugins/debugger/src/main/java/org/robovm/debugger/utils/bytebuffer/CompositeDataBuffer.java +++ b/plugins/debugger/src/main/java/org/robovm/debugger/utils/bytebuffer/CompositeDataBuffer.java @@ -138,7 +138,7 @@ public int readInt32() { @Override public long readLong() { - return activeRegion.readInt32(); + return activeRegion.readLong(); } @Override