Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4398381

java.awt.image.DataBufferShort should check for negative size

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • None
    • 1.4.0
    • client-libs
    • 2d
    • generic
    • generic

    Description



      Name: naC79102 Date: 12/15/2000



      Few methods in java.awt.image.DataBufferShort does not throw exception
      if
      the size of the DataBuffer,which is one of it's parameter,takes a
      negative value.
      However this condition is never actually checked by the API and an
      exception is
      not thrown if the size is negative.
                      The constructors that show this bug are
      DataBufferShortTest3 , DataBufferShortTest4,DataBufferShortTest5 and
      DataBufferShortTest6.

       Sample code follows....
       package javasoft.sqe.tests.api.java.awt.java2d.image.DataBufferShort;

       import java.awt.image.DataBufferShort;
       import java.awt.image.DataBuffer;

       public class test {
       public test() {

        try{
              new DataBufferShort(new short[] {2,3,4,5},-10);
           System.out.println("ran without error");
              }catch(Exception ee)
              { System.out.println("ran with error");}


        try{
              new DataBufferShort(new short[][] {{2,3},{3,4}},-5,new
      int[]{1,2});
           System.out.println("ran without error");
              }catch(Exception ee)
              { System.out.println("ran with error");}


        try{
              new DataBufferShort(new short[][] {{2,3},{3,4}},-5);
           System.out.println("ran without error");
              }catch(Exception ee)
              { System.out.println("ran with error");}


          try{
              new DataBufferShort(new short[]{1,2,3,4,1,3},-2,3);
           System.out.println("ran without error");
              }catch(Exception ee)
              { System.out.println("ran with error");}
        }
       public static void main(String[] args) {
              new test();
      }
      }

      ======================================================================

      Name: naC79102 Date: 12/15/2000

      Oops...I mentioned my testcases by mistake....the
      methods are DataBufferShort(short[][] dataArray, int size)
              DataBufferShort(short[][] dataArray, int size, int[] offsets)
              DataBufferShort(short[] dataArray, int size)
              DataBufferShort(short[] dataArray, int size, int offset)



      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              jrevans Jerald Evans (Inactive)
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Imported:
                Indexed: