Bug 7025 - Xvnc segmentation fault with Teamcenter and Chinese fonts
Summary: Xvnc segmentation fault with Teamcenter and Chinese fonts
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: VNC (show other bugs)
Version: 4.7.0
Hardware: PC Linux Red Hat
: P2 Major
Target Milestone: 4.9.0
Assignee: Henrik Andersson
Keywords: derfian_tester, prosaic, thomas_tester
Depends on:
Reported: 2017-08-08 11:45 CEST by Karl Mikaelsson
Modified: 2017-08-23 14:38 CEST (History)
3 users (show)

See Also:
Acceptance Criteria:

Font file and fonts.dir / fonts.scaled from customer (5.43 MB, application/zip)
2017-08-16 12:05 CEST, Henrik Andersson

Description Karl Mikaelsson cendio 2017-08-08 11:45:35 CEST
We got a report from a customer that their ThinLinc (4.7.0) sessions crash when they're using TeamCenter. The customer also reports that ThinLinc 4.1.1 works fine.

> (EE) 
> (EE) Backtrace:
> (EE) 0: /opt/thinlinc/libexec/Xvnc (xorg_backtrace+0x3f) [0x5d7c3f]
> (EE) 1: /opt/thinlinc/libexec/Xvnc (0x400000+0x1db0c9) [0x5db0c9]
> (EE) 2: /lib64/libpthread.so.0 (0x3e3a000000+0xf710) [0x3e3a00f710]
> (EE) 3: /opt/thinlinc/libexec/Xvnc (0x400000+0x2504d5) [0x6504d5]
> (EE) 4: /opt/thinlinc/libexec/Xvnc (0x400000+0x250a0a) [0x650a0a]
> (EE) 5: /opt/thinlinc/libexec/Xvnc (0x400000+0x2517bb) [0x6517bb]
> (EE) 6: /opt/thinlinc/libexec/Xvnc (FontEncReallyLoad+0x42) [0x651912]
> (EE) 7: /opt/thinlinc/libexec/Xvnc (FontEncFind+0x79) [0x64faf9]
> (EE) 8: /opt/thinlinc/libexec/Xvnc (FTPickMapping+0xc9) [0x647b29]
> (EE) 9: /opt/thinlinc/libexec/Xvnc (0x400000+0x22d813) [0x62d813]
> (EE) 10: /opt/thinlinc/libexec/Xvnc (0x400000+0x231596) [0x631596]
> (EE) 11: /opt/thinlinc/libexec/Xvnc (0x400000+0x2341cb) [0x6341cb]
> (EE) 12: /opt/thinlinc/libexec/Xvnc (0x400000+0x246365) [0x646365]
> (EE) 13: /opt/thinlinc/libexec/Xvnc (FontFileListNextFontWithInfo+0x53) [0x646403]
> (EE) 14: /opt/thinlinc/libexec/Xvnc (0x400000+0x242975) [0x642975]
> (EE) 15: /opt/thinlinc/libexec/Xvnc (doListFontsWithInfo+0x17b) [0x58a52b]
> (EE) 16: /opt/thinlinc/libexec/Xvnc (StartListFontsWithInfo+0x163) [0x58c5c3]
> (EE) 17: /opt/thinlinc/libexec/Xvnc (Dispatch+0x28f) [0x58911f]
> (EE) 18: /opt/thinlinc/libexec/Xvnc (main+0x3ae) [0x49d51e]
> (EE) 19: /lib64/libc.so.6 (__libc_start_main+0xfd) [0x3e3981ed1d]
> (EE) 20: /opt/thinlinc/libexec/Xvnc (0x400000+0x9eec3) [0x49eec3]
> (EE) 
> (EE) Segmentation fault at address 0x3e00003ff6
> Fatal server error:
> Caught signal 11 (Segmentation fault). Server aborting
Comment 3 Henrik Andersson cendio 2017-08-16 12:05:43 CEST
Created attachment 811 [details]
Font file and fonts.dir / fonts.scaled from customer
Comment 4 Henrik Andersson cendio 2017-08-16 12:10:22 CEST
How to use / test:

- unpack simsun.tcc / fonst.dir and fonst.scaled into ~/.fonts

- cd into ~/.fonts and run mkfontsdir to update fonts.dir from fonts.scaled

- update fontpath with 'xset +fp ~/.fonts'

- run xlsfonts and verify that the three simsun fonts are loaded into X11 
  server with different encodings

Then run xfontsel and select a simsun font famly (fmly) and then gb2312.1980
in rgstry to get rendered chines characters.
Comment 5 Henrik Andersson cendio 2017-08-16 12:13:35 CEST
The rendering is broken while viewing any of the fonts using xfontsel within Xvnc (ThinLinc 4.9.0). When the same test on Fedora 26 X11 server renders the fonts without a problem.

We can not crash the xfontsel but this indicates that Xvnc and core fonts rendering has problem. Updating freetype and libfontenc seems like a proper step in the right direction.
Comment 7 Henrik Andersson cendio 2017-08-16 15:36:34 CEST
xfontsel still fails to render after upgraded Xvnc. However freetype does now log that it can't find the encodings for the fonts.

  FreeType: couldn't find encoding 'ascii-0' for '/home/hean01/.fonts/simsun.ttc'
  FreeType: couldn't find encoding 'gb2312.1980-0' for '/home/hean01/.fonts/simsun.ttc'

I tried same tests using Xvnc from my build which fails and with Xvnc from fedora with success.

I found that if I created a enconding index (encoding.dir) file in the same directory as the fontfile ( ~/.fonts ) fixed the problem and the font is now rendered successfully. Here is how I created the encodings index:

  cd ~/.fonts
  mkfontdir -e /usr/share/fonts/encodings -e /usr/share/fonts/encodings/large .
Comment 8 Henrik Andersson cendio 2017-08-21 12:31:58 CEST
Still waiting for clearance from customer. However the upgrade of freetype on bug #5160 and this change, makes the simsun font to render properly.
Comment 9 Thomas Nilefalk cendio 2017-08-23 14:38:26 CEST
Tested on RHEL 7 by

- create directory with the simsun font
- mkfontscale to create fonts.scale
- mkfontdir to create fonts.dir
- add link to directory in /etc/X11/fontpath.d


- verified that font is found by xlsfonts | grep simsun

- verified that chinese characters are shown in xfontsel after:
  - selecting simsun family
  - selecting gb2312.1980 registry

- verified no message about X11 in xinit.log

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