From f38c4e25c6d8fa1fdfd9f25134fce14c4bb7fab8 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 22 Apr 2013 18:57:26 -0600 Subject: [PATCH] fix array class name length calculation in invoke The original calculation ommitted the last character, changing e.g. "[I" into "[". --- src/avian/classpath-common.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/avian/classpath-common.h b/src/avian/classpath-common.h index eede892293..951d16b97d 100644 --- a/src/avian/classpath-common.h +++ b/src/avian/classpath-common.h @@ -527,10 +527,16 @@ invoke(Thread* t, object method, object instance, object args) case 'J': type = vm::type(t, Machine::LongType); break; case 'D': type = vm::type(t, Machine::DoubleType); break; - case 'L': ++ p; + case 'L': case '[': { objectType = true; - unsigned nameLength = it.s - p; + unsigned nameLength; + if (*p == 'L') { + ++ p; + nameLength = it.s - p; + } else { + nameLength = (it.s - p) + 1; + } THREAD_RUNTIME_ARRAY(t, char, name, nameLength); memcpy(RUNTIME_ARRAY_BODY(name), p, nameLength - 1); RUNTIME_ARRAY_BODY(name)[nameLength - 1] = 0;