JDK-4451941 : JDWP: Evaluating method call with primitive array parameter gives Unexpected Sig
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 1.3.0,1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,windows_nt
  • CPU: generic,x86
  • Submitted: 2001-04-27
  • Updated: 2002-08-30
  • Resolved: 2002-08-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 beta3Fixed
Related Reports
Duplicate :  
Relates :  
Description

Name: tb29552			Date: 04/27/2001


/*

sample program:

*/
public class Untitled20 {

    public String xyz(char[] param) {
        return "abc";
    }

    public static void main(String[] args) {
        char[] x = new char[20];

        Untitled20 xx = new Untitled20 ();
        String bb = xx.xyz(x);
        // add a line breakpoint on the next line:
        System.out.println(bb); /* stop at Untitled20:18
                                 * run
                                 * print xx.xyz(x)
                                 */
    }
}

======================================================================
tim.bell@Eng 2001-04-30

This seems to affect only arrays of primitive type.
I modified Untitled20.java as follows:


/*

sample program:

*/
public class Untitled20 {

    public String xyz(char[] param) {
        return "abc";
    }

    public String xyz2(Object[] param) {
        return "def";
    }

    public static void main(String[] args) {
        char[] x = new char[20];
        Object[] y = new Object[20];
        Untitled20 xx = new Untitled20 ();

        String bb = xx.xyz(x);
        String cc = xx.xyz2(y);
        // add a line breakpoint on the next line:
        System.out.println(bb); /* stop at Untitled20:24
                                 * run
                                 * print xx.xyz2(y)
                                 * print xx.xyz(x)
                                 */
        System.out.println(cc);
    }
}


Once inside jdb and at a breakpoint on line 24, I evaluated
"print xx.xyz2(y)" 20 times with no error.  Next I did a
"print xx.xyz(x)" and got the Signal 11 first time.


Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta2 merlin-beta3 FIXED IN: merlin-beta3 merlin-rc1 INTEGRATED IN: merlin-beta3 VERIFIED IN: merlin-beta3
14-06-2004

WORK AROUND From dup bug 4416196: invoking method through JDWP with byte[] argument may crash backend 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

SUGGESTED FIX From dup bug 4416196: invoking method through JDWP with byte[] argument may crash backend (company - Day Management AG , email - ###@###.###) ====================================================================== 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)
11-06-2004

PUBLIC COMMENTS .
10-06-2004

EVALUATION This bug appears to have an intermitent nature. Yesterday I could reproduce it under b62 as Tim did, today b62 works for me and b63 falls over, but with a different location: Unexpected Signal : 11 occurred at PC=0xFE506244 Function=jio_vsnprintf+0x12E0 Library=/export/1.4c/build/solaris-sparc/lib/sparc/client/libjvm.so % errorID 4F530E43505002D7 01 os.cpp, 727 robert.field@Eng 2001-05-02 This appears to be related to JVMDI bug 4450091. Recommend fixing the JVMDI bug first and seeing if this bug still exists. janet.koenig@Eng 2001-06-13 begin - robert.field@Eng 2001-08-07 This bug is unrelated to 4450091. Cause of problem is as described in dup bug 4416196 is correct - and I quote: 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 end quote. As can be seen, a primitive array arg (signature e.g. "[I"), will cause the strchr() to go search out through memory for the SIGNATURE_END_CLASS (a ";") if not found before the end of a block you will get a seg fault - whence the intermittent nature. The proposed fix, however, will cause arguments to be by-passed. I believe the fix would be -- static jbyte nextArgumentTypeTag(void **cursor) { char *tagPtr = *cursor; jbyte argumentTag = (jbyte)*tagPtr; if (*tagPtr != SIGNATURE_END_ARGS) { /* Skip any array modifiers */ while (*tagPtr == JDWP_Tag_ARRAY) { tagPtr++; } /* Skip class name */ if (*tagPtr == JDWP_Tag_OBJECT) { tagPtr = strchr(tagPtr, SIGNATURE_END_CLASS) + 1; JDI_ASSERT(tagPtr); } else { /* Skip primitive sig */ tagPtr++; } } *cursor = tagPtr; return argumentTag; } end - robert.field@Eng 2001-08-07
07-08-2001