This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

java/1150: gcj permits assignment to array length



>Number:         1150
>Category:       java
>Synopsis:       gcj permits assignment to array length
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    tromey
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:06:37 PST 2000
>Closed-Date:    Sat Apr 15 20:39:38 PDT 2000
>Last-Modified:  Sat Apr 15 20:40:01 PDT 2000
>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:

Formerly PR gcj/140


From: Bryce McKinlay <bryce@albatross.co.nz>
To: java-gnats@sourceware.cygnus.com, jsturm@sigma6.com, apbianco@cygnus.com
Cc:  
Subject: Re: gcj/140
Date: Mon, 06 Mar 2000 13:50:35 +1300

 I checked the current status of this. gcj (20000305) now correctly
 reports the error when compiling to native:
 
 $ gcj ArrayTest.java -o arraytest --main=ArrayTest
 ArrayTest.java: In class `ArrayTest':
 ArrayTest.java: In method `main(java.lang.String[])':
 ArrayTest.java:10: Can't assign a value to the final variable
 `a.length'.
                a.length = 3000;
 
 But "gcj -C", compiling to bytecode, does not.
 
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&pr=140&database=java
 
 
 

From: tromey@sourceware.cygnus.com
To: java-gnats@sourceware.cygnus.com
Cc:  
Subject: gcj/140
Date: 15 Mar 2000 01:45:10 -0000

 CVSROOT:	/cvs/java
 Module name:	libgcj
 Changes by:	tromey@sourceware.cygnus.com	00/03/14 17:45:10
 
 Modified files:
 	libjava/testsuite: ChangeLog 
 Added files:
 	libjava/testsuite/libjava.compile: PR140.java 
 
 Log message:
 	* libjava.compile/PR140.java: New file, for PR gcj/140.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/gcc/libjava/testsuite/ChangeLog.diff?cvsroot=java&r1=1.69&r2=1.70
 http://gcc.gnu.org/cgi-bin/gcc/libjava/testsuite/libjava.compile/PR140.java.diff?cvsroot=java&r1=NONE&r2=1.1
 
Responsible-Changed-From-To: apbianco->tromey
Responsible-Changed-By: tromey
Responsible-Changed-When: Wed Apr  5 22:20:14 2000
Responsible-Changed-Why:
    I fixed this.
State-Changed-From-To: open->feedback
State-Changed-By: tromey
State-Changed-When: Wed Apr  5 22:20:14 2000
State-Changed-Why:
    I checked in a patch:
    http://gcc.gnu.org/ml/gcc-patches/2000-04/msg00211.html
    Could you try it out?
    If not, tell me and I'll just close the PR.

From: tromey@cygnus.com
To: apbianco@cygnus.com, java-gnats@sourceware.cygnus.com, jsturm@sigma6.com,
  tromey@cygnus.com
Cc:  
Subject: Re: gcj/140
Date: 6 Apr 2000 05:20:14 -0000

 Synopsis: gcj permits assignment to array length
 
 Responsible-Changed-From-To: apbianco->tromey
 Responsible-Changed-By: tromey
 Responsible-Changed-When: Wed Apr  5 22:20:14 2000
 Responsible-Changed-Why:
     I fixed this.
 State-Changed-From-To: open->feedback
 State-Changed-By: tromey
 State-Changed-When: Wed Apr  5 22:20:14 2000
 State-Changed-Why:
     I checked in a patch:
     http://gcc.gnu.org/ml/gcc-patches/2000-04/msg00211.html
     Could you try it out?
     If not, tell me and I'll just close the PR.
 
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&pr=140&database=java
State-Changed-From-To: feedback->closed
State-Changed-By: tromey
State-Changed-When: Sat Apr 15 20:39:38 2000
State-Changed-Why:
    Confirmed.

From: Jeff Sturm <jsturm@sigma6.com>
To: java-gnats@sourceware.cygnus.com, tromey@cygnus.com
Cc:  
Subject: Re: gcj/140
Date: Sat, 15 Apr 2000 23:42:59 -0400

 Gcj now generates an error as if `length' were final.  I think you can
 close this one (sorry it took so long).
 
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&pr=140&database=java
 
 --
 Jeff Sturm
 jsturm@sigma6.com

From: tromey@cygnus.com
To: java-gnats@sourceware.cygnus.com, jsturm@sigma6.com, tromey@cygnus.com
Cc:  
Subject: Re: gcj/140
Date: 16 Apr 2000 03:39:38 -0000

 Synopsis: gcj permits assignment to array length
 
 State-Changed-From-To: feedback->closed
 State-Changed-By: tromey
 State-Changed-When: Sat Apr 15 20:39:38 2000
 State-Changed-Why:
     Confirmed.
 
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&pr=140&database=java
>Unformatted:



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]