View Issue Details

IDProjectCategoryView StatusLast Update
0022105Open CASCADEOCCT:Visualizationpublic2012-03-29 17:26
ReportersanAssigned Tobugmaster  
PrioritynormalSeveritytrivial 
Status closedResolutionfixed 
OSAll 
Fixed in Version6.5.1 
Summary0022105: Suspicious call to XOpenDisplay() in OSD_FontMgr class
DescriptionIn OSD_FontMgr::InitFontDataBase() the following line results in a crash of an
application using 3D viewer through a remote connection to Cygwin X server:

  Display * disp = XOpenDisplay("localhost:0.0");

Xlib manual for XOpenDisplay() says that:

=============================================
Syntax


Display *XOpenDisplay(display_name)
      char *display_name;

Arguments
display_name Specifies the hardware display name, which determines the display
and communications domain to be used. On a POSIX-conformant system, if the
display_name is NULL, it defaults to the value of the DISPLAY environment variable.

=============================================

The font manager should collect the fonts available to the X server used by the
application. Therefore it is necessary at least to try to call
XOpenDisplay(NULL) and check if text rendering works well for both local and
remote connections to X servers (both Linux and Windows X servers should be
checked).
Additional information
and documentation updates
Documentation remark, added by APL 2011-03-24 12:55:50:

Changes:
There are following changes in packages:
OSD package:
  1) The OSD_FontManager::InitFontDataBase method algorithm corrected. Now
     there is connection to client's display with XOpenDisplay("localhost:0.0")
     call at first, and then, if it is failed, with XOpenDisplay(":0.0") call.

OpenGl package:
  1) The OpenGl_TextRender::RenderText corrected. There was an uncontrolled
     memory allocation if the OSD_FontManager's font database was empty.
TagsNo tags attached.
Test case number

Attached Files

  • apl-OCC22105-v1.tar.gz (7,828 bytes)

Activities

2011-03-24 14:31

 

apl-OCC22105-v1.tar.gz (7,828 bytes)

abv

2011-08-05 17:11

manager   ~0017924

See message on the forum thread http://www.opencascade.org/org/forum/thread_21351/ by Denis Barbier:

> see http://www.opencascade.org/org/forum/thread_20101/ for instance, they applied a wrong fix in OCCT 6.5.1

I guess he means that using NULL would be better than ":0.0" -- Sergey and Anton, what is your idea?

san

2011-08-05 19:14

developer   ~0017926

Hello Andrey,

The reason why we cannot use XOpenDisplay( NULL ) call in OSD_FontMgr is that we need to enumerate the font files located on the machine where the application is executed - that is, on the "localhost" in terms of code execution.
NULL argument value implies that the existing X connection is used.
There is no difference when an application is run locally.
However, if an application is run remotely, the existing X connection usually leads us to the wrong machine: a GUI application normally has the X display on the local machine, while the application code is executed on a remote machine.
As a result, we obtain the wrong font files (located on the X server side!), which cannot be accessed later by FreeType and FTGL from the localhost machine.

Best regards,
Sergey

san

2011-08-05 19:22

developer   ~0017927

Last edited: 2011-12-26 18:12

Reminder sent to: atp

Hello ATP,

Could you please copy the text of 0022105:0017926 and post it as the answer in the OCCT forum post in http://www.opencascade.org/org/forum/thread_21351/ by Denis Barbier of 2011/08/05 14:41?

Thanks in advance!
Sergey

Related Changesets

occt: master 28e85034

2011-04-28 15:04:33

apl


Committer: bugmaster Details Diff
OCC22105 Suspicious call to XOpenDisplay() in OSD_FontMgr class Affected Issues
0022105
mod - src/OpenGl/OpenGl_TextRender.cxx Diff File
mod - src/OSD/OSD_FontMgr.cxx Diff File

Issue History

Date Modified Username Field Change
2010-11-03 18:21 san CC => vsr
2010-11-10 11:59 bugmaster Assigned To bugmaster => psn
2010-11-10 11:59 bugmaster Status new => assigned
2010-11-12 17:38 psn Status assigned => resolved
2011-02-10 14:58 bugmaster Assigned To psn => san
2011-02-10 14:58 bugmaster Status resolved => assigned
2011-03-11 12:04 san Assigned To san => apl
2011-03-24 14:56 apl Status assigned => resolved
2011-04-06 18:57 mkv Status resolved => tested
2011-04-28 19:04 bugmaster Status tested => verified
2011-08-02 11:24 bugmaster Category OCCT:VIZ => OCCT:Visualization
2011-08-05 17:11 abv Note Added: 0017924
2011-08-05 19:14 san Note Added: 0017926
2011-08-05 19:22 san Note Added: 0017927
2011-12-26 18:11 atp Description Updated
2011-12-26 18:11 atp Additional Information Updated
2011-12-26 18:12 atp Note Edited: 0017927
2012-03-29 17:26 bugmaster Changeset attached => occt master 28e85034