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

ArrayIndexOutOfBoundsException during Eastern Font access in JList on Linux

XMLWordPrintable

    • 2d
    • x86_64
    • linux

      FULL PRODUCT VERSION :
      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux donald 3.16.7-21-desktop #1 SMP PREEMPT Tue Apr 14 07:11:37 UTC 2015 (93c1539) x86_64 x86_64 x86_64 GNU/Linux

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      The TTF list on my system might be helpful:
      ===============8<------------------------------------
      andalemo.ttf
      arialbd.ttf
      arialbi.ttf
      ariali.ttf
      arial.ttf
      ariblk.ttf
      Arimo-BoldItalic.ttf
      Arimo-Bold.ttf
      Arimo-Italic.ttf
      Arimo-Regular.ttf
      Cantarell-Bold.otf
      Cantarell-Regular.otf
      Carlito-BoldItalic.ttf
      Carlito-Bold.ttf
      Carlito-Italic.ttf
      Carlito-Regular.ttf
      comicbd.ttf
      comic.ttf
      courbd.ttf
      courbi.ttf
      couri.ttf
      cour.ttf
      Cousine-BoldItalic.ttf
      Cousine-Bold.ttf
      Cousine-Italic.ttf
      Cousine-Regular.ttf
      DejaVuSans-BoldOblique.ttf
      DejaVuSans-Bold.ttf
      DejaVuSansCondensed-BoldOblique.ttf
      DejaVuSansCondensed-Bold.ttf
      DejaVuSansCondensed-Oblique.ttf
      DejaVuSansCondensed.ttf
      DejaVuSans-ExtraLight.ttf
      DejaVuSansMono-BoldOblique.ttf
      DejaVuSansMono-Bold.ttf
      DejaVuSansMono-Oblique.ttf
      DejaVuSansMono.ttf
      DejaVuSans-Oblique.ttf
      DejaVuSans.ttf
      DejaVuSerif-BoldItalic.ttf
      DejaVuSerif-Bold.ttf
      DejaVuSerifCondensed-BoldItalic.ttf
      DejaVuSerifCondensed-Bold.ttf
      DejaVuSerifCondensed-Italic.ttf
      DejaVuSerifCondensed.ttf
      DejaVuSerif-Italic.ttf
      DejaVuSerif.ttf
      DroidKufi-Bold.ttf
      DroidKufi-Regular.ttf
      DroidNaskh-Bold.ttf
      DroidNaskh-Regular-SystemUI.ttf
      DroidNaskh-Regular.ttf
      DroidSansArmenian.ttf
      DroidSans-Bold.ttf
      DroidSansDevanagari-Regular.ttf
      DroidSansEthiopic-Bold.ttf
      DroidSansEthiopic-Regular.ttf
      DroidSansFallbackFull.ttf
      DroidSansGeorgian.ttf
      DroidSansHebrew-Bold.ttf
      DroidSansHebrew-Regular.ttf
      DroidSansJapanese.ttf
      DroidSansMono.ttf
      DroidSansTamil-Bold.ttf
      DroidSansTamil-Regular.ttf
      DroidSansThai.ttf
      DroidSans.ttf
      DroidSerif-BoldItalic.ttf
      DroidSerif-Bold.ttf
      DroidSerif-Italic.ttf
      DroidSerif-Regular.ttf
      encodings.dir
      fonts.dir
      fonts.scale
      georgiab.ttf
      georgiai.ttf
      georgia.ttf
      georgiaz.ttf
      GohaTibebZemen.otf
      impact.ttf
      LiberationMono-BoldItalic.ttf
      LiberationMono-Bold.ttf
      LiberationMono-Italic.ttf
      LiberationMono-Regular.ttf
      LiberationSans-BoldItalic.ttf
      LiberationSans-Bold.ttf
      LiberationSans-Italic.ttf
      LiberationSansNarrow-BoldItalic.ttf
      LiberationSansNarrow-Bold.ttf
      LiberationSansNarrow-Italic.ttf
      LiberationSansNarrow-Regular.ttf
      LiberationSans-Regular.ttf
      LiberationSerif-BoldItalic.ttf
      LiberationSerif-Bold.ttf
      LiberationSerif-Italic.ttf
      LiberationSerif-Regular.ttf
      luximbi.ttf
      luximb.ttf
      luximri.ttf
      luximr.ttf
      luxirbi.ttf
      luxirb.ttf
      luxirri.ttf
      luxirr.ttf
      luxisbi.ttf
      luxisb.ttf
      luxisri.ttf
      luxisr.ttf
      OpenSans-BoldItalic.ttf
      OpenSans-Bold.ttf
      OpenSans-CondBold.ttf
      OpenSans-CondLightItalic.ttf
      OpenSans-CondLight.ttf
      OpenSans-ExtraBoldItalic.ttf
      OpenSans-ExtraBold.ttf
      OpenSans-Italic.ttf
      OpenSans-LightItalic.ttf
      OpenSans-Light.ttf
      OpenSans-Regular.ttf
      OpenSans-SemiboldItalic.ttf
      OpenSans-Semibold.ttf
      starsymbol.ttf
      SymbolNeu.ttf
      SyrCOMAdiabene.otf
      SyrCOMAntioch.otf
      SyrCOMBatnanBold.otf
      SyrCOMBatnan.otf
      SyrCOMCtesiphon.otf
      SyrCOMEdessa.otf
      SyrCOMJerusalemBold.otf
      SyrCOMJerusalemItalic.otf
      SyrCOMJerusalem.otf
      SyrCOMJerusalemOutline.otf
      SyrCOMKharput.otf
      SyrCOMMalankara.otf
      SyrCOMMardinBold.otf
      SyrCOMMardin.otf
      SyrCOMMidyat.otf
      SyrCOMNisibin.otf
      SyrCOMNisibinOutline.otf
      SyrCOMQenNeshrin.otf
      SyrCOMTalada.otf
      SyrCOMTurAbdin.otf
      SyrCOMUrhoyBold.otf
      SyrCOMUrhoy.otf
      timesbd.ttf
      timesbi.ttf
      timesi.ttf
      times.ttf
      Tinos-BoldItalic.ttf
      Tinos-Bold.ttf
      Tinos-Italic.ttf
      Tinos-Regular.ttf
      trebucbd.ttf
      trebucbi.ttf
      trebucit.ttf
      trebuc.ttf
      verdanab.ttf
      verdanai.ttf
      verdana.ttf
      verdanaz.ttf
      webdings.ttf
      yudit.ttf
      ===============8<------------------------------------

      If necessary I can also provide the associated fonts.dir, but as it has 3300 lines I don't add it here.


      A DESCRIPTION OF THE PROBLEM :
      The attached test case crashes with the attached ArrayIndexOutOfBoundsException.

      The underlying problem appeared in late Java 7 and every Java 8 release I tested,. but I hadn't found the time to break down everything to a neat example yet,


      REGRESSION. Last worked in version 7u75

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.7.0_45"
      Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
      Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

      Other versions I tried:
      In latest 7 (79-b15) version the problem already appears.
      In latest 9 (ea-b68) version no exception is thrown, but there is no text displayed either.
      On Windows I never saw any problems.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile program and run.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      List with one element using eastern font is displayed in frame.
      ACTUAL -
      Exceptiion thrown, list content is not displayed.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -28311551
              at sun.font.FileFontStrike.setCachedGlyphPtr(FileFontStrike.java:520)
              at sun.font.FileFontStrike.setCachedGlyphPtr(FileFontStrike.java:537)
              at sun.font.FileFontStrike.getSlot0GlyphImagePtrs(FileFontStrike.java:449)
              at sun.font.CompositeStrike.getGlyphImagePtrs(CompositeStrike.java:115)
              at sun.font.GlyphList.mapChars(GlyphList.java:272)
              at sun.font.GlyphList.setFromString(GlyphList.java:244)
              at sun.java2d.pipe.GlyphListPipe.drawString(GlyphListPipe.java:71)
              at sun.java2d.pipe.ValidatePipe.drawString(ValidatePipe.java:165)
              at sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2928)
              at sun.swing.SwingUtilities2.drawString(SwingUtilities2.java:572)
              at sun.swing.SwingUtilities2.drawStringUnderlineCharAt(SwingUtilities2.java:612)
              at javax.swing.plaf.basic.BasicLabelUI.paintEnabledText(BasicLabelUI.java:119)
              at javax.swing.plaf.basic.BasicLabelUI.paint(BasicLabelUI.java:179)
              at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
              at javax.swing.JComponent.paintComponent(JComponent.java:780)
              at javax.swing.JComponent.paint(JComponent.java:1056)
              at javax.swing.CellRendererPane.paintComponent(CellRendererPane.java:151)
              at javax.swing.plaf.basic.BasicListUI.paintCell(BasicListUI.java:227)
              at javax.swing.plaf.basic.BasicListUI.paintImpl(BasicListUI.java:317)
              at javax.swing.plaf.basic.BasicListUI.paint(BasicListUI.java:240)
              at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
              at javax.swing.JComponent.paintComponent(JComponent.java:780)
              at javax.swing.JComponent.paint(JComponent.java:1056)
              at javax.swing.JComponent.paintChildren(JComponent.java:889)
              at javax.swing.JComponent.paint(JComponent.java:1065)
              at javax.swing.JComponent.paintChildren(JComponent.java:889)
              at javax.swing.JComponent.paint(JComponent.java:1065)
              at javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
              at javax.swing.JComponent.paintChildren(JComponent.java:889)
              at javax.swing.JComponent.paintToOffscreen(JComponent.java:5226)
              at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:290)
              at javax.swing.RepaintManager.paint(RepaintManager.java:1265)
              at javax.swing.JComponent.paint(JComponent.java:1042)
              at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
              at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:79)
              at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:116)
              at java.awt.Container.paint(Container.java:1973)
              at java.awt.Window.paint(Window.java:3912)
              at javax.swing.RepaintManager$4.run(RepaintManager.java:835)
              at javax.swing.RepaintManager$4.run(RepaintManager.java:807)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
              at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:807)
              at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:782)
              at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:731)
              at javax.swing.RepaintManager.access$1300(RepaintManager.java:64)
              at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1720)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
              at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
              at java.awt.EventQueue.access$500(EventQueue.java:97)
              at java.awt.EventQueue$3.run(EventQueue.java:709)
              at java.awt.EventQueue$3.run(EventQueue.java:703)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.*;

      public class LinuxFontCrash
      {
        private static final String TEXT = "かくれ線";
        
        public static void main(String[] args)
        {
          System.out.println(System.getProperty("java.version"));
          JFrame frame = new JFrame("Crash Test Dummy");
          JList list = new JList(new Object[] { TEXT });
          frame.getContentPane().add(list, BorderLayout.CENTER);
          frame.setSize(200, 200);
          frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
          frame.setVisible(true);
        }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Trying to set some different fonts did not help me, just the offending index is changing (eg .-33554431 for Google OpenSans).
      Only setting fonts which do not contain the given characters will avoid the exception, but in that case only placeholders will be displayed which is not perfectly helpful.

            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: