Bug 1479563

Summary: Exception using stix-fonts with openjdk
Product: Red Hat Enterprise Linux 7 Reporter: Paulo Andrade <pandrade>
Component: java-1.8.0-openjdkAssignee: Mario Torre <neugens>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.3CC: ahughes, ajipatil, ayadav, dkochuka, jvanek, jwright, markbutt, mrichter, neugens, qguo, rmetrich, skeens_kristi, tmiyargi
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-11 10:56:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1484079    
Bug Blocks:    
Attachments:
Description Flags
FontTest.java none

Description Paulo Andrade 2017-08-08 19:52:12 UTC
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;

Comment 2 Andrew John Hughes 2017-08-24 18:34:11 UTC
Mario, one for you?

Comment 3 Mario Torre 2017-08-24 18:41:24 UTC
(In reply to Andrew John Hughes from comment #2)
> Mario, one for you?

Isn't that a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1484079 ?

Comment 4 Mario Torre 2017-08-31 11:30:13 UTC
I made that a dependency of https://bugzilla.redhat.com/show_bug.cgi?id=1484079 since I'm logging work on that bug, as far as I can tell it's the same issue.

Comment 5 Andrew John Hughes 2017-09-05 16:17:38 UTC
(In reply to Mario Torre from comment #3)
> (In reply to Andrew John Hughes from comment #2)
> > Mario, one for you?
> 
> Isn't that a duplicate of
> https://bugzilla.redhat.com/show_bug.cgi?id=1484079 ?

I asked the same in https://bugzilla.redhat.com/show_bug.cgi?id=1484079#c8 ;)

Comment 6 Mario Torre 2017-10-06 09:54:49 UTC
I'm working with upstream for this bug (and 1484079), for now I think we can ship our RPMs with this patch on the next update, since things will likely take longer.

Comment 7 Marc Richter 2017-10-06 17:14:24 UTC
Mario,

Can you clarify the expectations for when the fix may appear? z-stream? 7.5?

Thanks!

Marc

Comment 8 Mark Butt 2017-10-10 15:01:19 UTC
Hi Mario,

We too are wondering if the date for the anticipated fix has been determined.
We are deploying CSDC's Amanda product on JBOSS 6.4 (RHEL 7.4) and are encountering several locations in the application where functions are failing to execute.  CSDC has traced the problem to this Bug so we are eager to get a resolution.

Thanks!
-M

Comment 9 Mario Torre 2017-10-10 16:43:37 UTC
(In reply to Mark Butt from comment #8)
> Hi Mario,
> 
> We too are wondering if the date for the anticipated fix has been determined.
> We are deploying CSDC's Amanda product on JBOSS 6.4 (RHEL 7.4) and are
> encountering several locations in the application where functions are
> failing to execute.  CSDC has traced the problem to this Bug so we are eager
> to get a resolution.

The quickest way to resolve would be to install an additional font or replace STIX with a non CFF one, which will make things work already now. As for the patch actually going in the rpm there are few things to still consider but the patch is basically ready and we are working on shipping it, I can't say if this will hit the next update, the best to do is to keep observing this bug report for news.

Comment 11 Mario Torre 2017-10-11 10:56:28 UTC

*** This bug has been marked as a duplicate of bug 1484079 ***