JDK-4416196 : invoking method through JDWP with byte[] argument may crash backend
  • Type: Bug
  • Component: vm-legacy
  • Sub-Component: jvmdi
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2001-02-16
  • Updated: 2001-05-18
  • Resolved: 2001-05-18
Related Reports
Duplicate :  
Description

Name: tb29552			Date: 02/16/2001


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


invoking a method through JDWP (cmd: JDWP_ClassType_InvokeMethod) with an array
of a primitive type (such as byte[]) as a method argument results in a back-end
crash.

this is caused by a bug in the function nextArgumentTypeTag (invoker.c):

////////////// begin original code
static jbyte
nextArgumentTypeTag(void **cursor)
{
    char *tagPtr = *cursor;
    jbyte argumentTag = (jbyte)*tagPtr;

    if (*tagPtr != SIGNATURE_END_ARGS) {
        /* Skip any class name or additional array modifiers */
        if ((*tagPtr == JDWP_Tag_ARRAY) ||
            (*tagPtr == JDWP_Tag_OBJECT)) {
            tagPtr = strchr(tagPtr, SIGNATURE_END_CLASS);
            JDI_ASSERT(tagPtr);
        }
        tagPtr++;
    }

    *cursor = tagPtr;
    return argumentTag;
}
////////////// end original code

////////////// begin fixed code
static jbyte
nextArgumentTypeTag(void **cursor)
{
    char *tagPtr = *cursor;
    jbyte argumentTag = (jbyte)*tagPtr;

    while (*tagPtr != SIGNATURE_END_ARGS) {
        /* Skip any class name or additional array modifiers */
        if (*tagPtr == JDWP_Tag_ARRAY) {
            tagPtr++;
            continue;
        }
        if (*tagPtr == JDWP_Tag_OBJECT) {
            tagPtr = strchr(tagPtr, SIGNATURE_END_CLASS);
            JDI_ASSERT(tagPtr);
        }
        tagPtr++;
        break;
    }

    *cursor = tagPtr;
    return argumentTag;
}
////////////// end fixed code
(Review ID: 117123) 
======================================================================

Comments
WORK AROUND Name: tb29552 Date: 02/16/2001 instead of invoking the method directly through JDWP (cmd: JDWP_ClassType_InvokeMethod) invoke it indirectly by calling Class.getMethod and Method.invoke through JDWP ======================================================================
11-06-2004