bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22786] ByteLookupTable and ShortLookupTable / index out o


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22786] ByteLookupTable and ShortLookupTable / index out of bounds
Date: 16 Oct 2005 01:27:12 -0000

The following code throws an ArrayIndexOutOfBoundsException:

  public static void main(String[] args) {
    byte[] data = {105, 104, 103, 102, 101, 100};
    ByteLookupTable t = new ByteLookupTable(100, data);
    // check 3-band source with 1-band lookup table
    int[] src = new int[] {100, 101, 102};
    int[] dst = t.lookupPixel(src, null);
  }

This bug is triggered in the lookupPixel(src, dst) methods of both the
java.awt.image.ByteLookupTable and java.awt.image.ShortLookupTable classes when
(a) dst is null, and (b) the number of bands in the lookup table is less than
the number of elements in src.

Looking at the source code, it appears that 'dst' should be initialised with
'src.length' elements, rather than 'numComponents' elements.

Mauve tests are attached.


------- Comment #1 from from-classpath at savannah dot gnu dot org  2004-10-13 
19:17 -------
I jst commited a fix for this and the attached testcases. Thanks for reporting
and suggesting a fix.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22786





reply via email to

[Prev in Thread] Current Thread [Next in Thread]