gcj/140: gcj permits assignment to array length

jsturm@sigma6.com jsturm@sigma6.com
Sun Jan 23 13:16:00 GMT 2000


>Number:         140
>Category:       gcj
>Synopsis:       gcj permits assignment to array length
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    apbianco
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 23 13:16:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Jeff Sturm
>Release:        current
>Organization:
>Environment:

>Description:
gcj permits assigment to array length member, resulting in
either buffer overruns (when compiling to native) or invalid
bytecode (when compiling to bytecode).
>How-To-Repeat:
Compile and run the program below (it should dump core):

public class ArrayTest {
    public static void fill(int[] a) {
        for (int i = 0; i < a.length; i++) {
            a[i] = i;
        }
    }
    public static void main(String[] args) {
        int[] a = new int[3];
        fill(a);
        a.length = 3000;
        fill(a);
    }
}
>Fix:
Modify gcj to report the error.
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Java-prs mailing list