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

Massive row or column header in JScrollPane crashes VM

XMLWordPrintable

    • 2d
    • 01
    • generic, x86
    • generic, windows_95, windows_98, windows_nt, windows_2000
    • Verified



      Name: mc57594 Date: 10/12/99


      If you make a JScrollPane with a massive (approaching Integer.MAX_VALUE) row or column header then the win32 VM will crash.

      This code demonstrates the bug (I got it to crash on 1.2.2 (hotspot and classic) and Kestral Beta):

      ~~~ START CODE ~~~

      import java.awt.*;
      import javax.swing.*;

      public class CrashTest {

        public static void main(String[] args) {

          JScrollPane scroll_pane = new JScrollPane(new JPanel());
          scroll_pane.setColumnHeaderView(new HeaderTest(true));
          scroll_pane.setRowHeaderView(new HeaderTest(false));

          JFrame frame = new JFrame();
          Container c = frame.getContentPane();
          c.add(scroll_pane);
          
          frame.pack();
          frame.setVisible(true);

        }

        static class HeaderTest extends JPanel {

          public HeaderTest(boolean horizontal) {
            if (horizontal) {
              setPreferredSize(new Dimension(Integer.MAX_VALUE, 10));
            }
            else {
              setPreferredSize(new Dimension(10, Integer.MAX_VALUE));
            }
          }

          public void paintComponent(Graphics g) {
            System.out.println(g.getClipBounds());

            System.out.println("Reached Step 1");
            g.setColor(Color.black);
            System.out.println("Reached Step 2");
            g.fillRect(0, 0, 5, 5);
            System.out.println("Reached Step 3");

          }
        
        }

      }

      ~~~ END CODE ~~~

      This is the output I get when run under Kestral Beta:

      H:\toby\dev\java\bug>C:\jdk1.3\bin\java CrashTest
      java.awt.Rectangle[x=0,y=0,width=10,height=2147483646]
      Reached Step 1
      Reached Step 2
      #
      # HotSpot Virtual Machine Error, EXCEPTION_ACCESS_VIOLATION
      #
      # Error ID: 4F533F57494E13120E43505002B0
      #

      abnormal program termination


      I get a similar error on JDK1.2.2 hotspot and with the classic VM. The code shows that the bug occurs when the 'fillRect' command is executed. I found the bug when testing an application with an extremely large JScrollPane area.

      The bug also occurs if just one of the axis extends to Integer.MAX_VALUE (They both extend to MAX_VALUE in the supplied code).

      --------------------

      10/9/99 eval1127@eng -- under kestrel RA (build "I"), with NT 4.0 SP 4, just a slightly-different HotSpot error ID:

      java.awt.Rectangle[x=0,y=0,width=10,height=2147483647]
      Reached Step 1
      Reached Step 2
      #
      # HotSpot Virtual Machine Error, EXCEPTION_ACCESS_VIOLATION
      #
      # Error ID: 4F533F57494E13120E43505002BE
      #

      (with Solaris 2.7:)

      % java CrashTest
      java.awt.Rectangle[x=0,y=0,width=10,height=2147483647]
      Reached Step 1
      Reached Step 2
      #
      # HotSpot Virtual Machine Error, Unexpected Signal 11
      #
      # Error ID: 4F533F534F4C415249530E4350500790 01
      #
      [error occured during error reporting]
      (Review ID: 96315)
      ======================================================================

            minqi Yumin Qi
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: