Bug 1479563 - Exception using stix-fonts with openjdk
Exception using stix-fonts with openjdk
Status: NEW
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: java-1.8.0-openjdk (Show other bugs)
7.3
All Linux
unspecified Severity medium
: rc
: ---
Assigned To: jiri vanek
BaseOS QE - Apps
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-08 15:52 EDT by Paulo Andrade
Modified: 2017-08-10 23:43 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
FontTest.java (776 bytes, text/plain)
2017-08-08 15:52 EDT, Paulo Andrade
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3145721 None None None 2017-08-09 09:28 EDT

  None (edit)
Description Paulo Andrade 2017-08-08 15:52:12 EDT
Created attachment 1310845 [details]
FontTest.java

Problem happens when only stix-fonts is available,
for example:

$ java FontTest
java.lang.ArrayIndexOutOfBoundsException: 0
	at sun.font.CompositeFont.getSlotFont(CompositeFont.java:351)
	at sun.font.CompositeGlyphMapper.initMapper(CompositeGlyphMapper.java:81)
	at sun.font.CompositeGlyphMapper.<init>(CompositeGlyphMapper.java:62)
	at sun.font.CompositeFont.getMapper(CompositeFont.java:409)
	at sun.font.CompositeFont.canDisplay(CompositeFont.java:435)
	at java.awt.Font.canDisplayUpTo(Font.java:2063)
	at java.awt.font.TextLayout.singleFont(TextLayout.java:470)
	at java.awt.font.TextLayout.<init>(TextLayout.java:531)
	at FontTest.main(FontTest.java:15)

But output should be usually:

$ java FontTest
result: 5

or:

result: 6


  Example steps to reproduce on Fedora:

dd if=/dev/zero of=f26.img bs=1G count=1
mkdir $PWD/f26.mount
mke2fs $PWD/f26.img
sudo mount $PWD/f26.img $PWD/f26.mount
sudo mock -r fedora-26-x86_64 --rootdir=$PWD/f26.mount --init
sudo mock -r fedora-26-x86_64 --rootdir=$PWD/f26.mount --install java-1.8.0-openjdk-devel stix-fonts
sudo cp FontTest.java $PWD/f26.mount
sudo mock -r fedora-26-x86_64 --rootdir=$PWD/f26.mount --shell

rpm -e aajohan-comfortaa-fonts-2.004-7.fc26.noarch  ## installed by default
javac FontTest.java
java FontTest
exit

sudo umount $PWD/f26.mount
sudo rmdir $PWD/f26.mount
sudo rm f26.img


  I am not 100% sure there is a problem with stix-fonts,
but this comment in sun/font/CompositeFont.java:CompositeFont()
may tell it should check bounds depending on what offset is
requested:

        /* We will limit the number of slots to 254.
         * We store the slot for a glyph id in a byte and we may use one slot
         * for an EUDC font, and we may also create a composite
         * using this composite as a backup for a physical font.
         * So we want to leave space for the two additional slots.
         */
         numSlots = (numSlots <= 254) ? numSlots : 254;

Note You need to log in before you can comment on or make changes to this bug.