xsrc/42281: X-server crash when using ms-ttf package

View: New views
3 Messages — Rating Filter:   Alert me  

Parent Message unknown xsrc/42281: X-server crash when using ms-ttf package

by Uwe KrÃŒger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>Number:         42281
>Category:       xsrc
>Synopsis:       X-server crash when using ms-ttf package
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    xsrc-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 07 20:45:00 +0000 2009
>Originator:     Uwe Krüger
>Release:        5-STABLE snapshot 20091102 (after xorg 1.6 pullup)
>Organization:
>Environment:
NetBSD shuttle 5.0_STABLE NetBSD 5.0_STABLE (GENERIC) #0: Mon Nov  2 16:10:10 UTC 2009  builds@...:/home/builds/ab/netbsd-5/amd64/200911020000Z-obj/home/builds/ab/netbsd-5/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
The X-Server crashes when trying to access Microsoft core fonts using "xfontsel".

Using gdb the crash can be isolated in the function pixman_region_intersect():

# gdb /usr/X11R7/bin/Xorg Xorg.core                                    
...
(gdb) bt
#0  0x00007f7ffc2dc26a in _lwp_kill () from /usr/lib/libc.so.12
#1  0x00007f7ffc2dbb42 in abort () from /usr/lib/libc.so.12
#2  0x00007f7ffc29d440 in __assert13 () from /usr/lib/libc.so.12
#3  0x00007f7ffda42fa7 in pixman_region_intersect ()
   from /usr/X11R7/lib/libpixman-1.so.1
#4  0x000000000050f4f7 in DamageRegionProcessPending ()
#5  0x000000000050f69a in DamageRegionAppend ()
#6  0x0000000000512886 in DamageSetup ()
#7  0x0000000000512c62 in DamageSetup ()
#8  0x000000000051315e in DamageSetup ()
#9  0x000000000044991f in doPolyText ()
#10 0x0000000000449dc4 in PolyText ()
#11 0x000000000044dd84 in ProcPolyText ()
#12 0x0000000000450076 in Dispatch ()
#13 0x000000000043afe5 in main ()

>How-To-Repeat:
- Install a recent netbsd-5 snapshot
- install the package fonts/ms-ttf and follow the instructions,
  in particular add 'FontPath     "/usr/pkg/lib/X11/fonts/TTF/"' to
  your xorg.conf
- restart the X-server
- run "xfontsel &"
- select fndry->microsoft
- the X-server crashes

(the crash only occurs when using the "native" X-server and not with the "modular-xorg-server" package)

>Fix:
based of the version 0.16 of pixman (which is used by the modular-xorg-server-package) I've created the following patch that solves the problem:

--- /usr/xsrc/external/mit/pixman/dist/pixman/pixman-region.c.orig 2009-09-19 13:23:38.000000000 +0200
+++ /usr/xsrc/external/mit/pixman/dist/pixman/pixman-region.c 2009-11-07 21:17:39.000000000 +0100
@@ -63,7 +63,10 @@
 #define PIXREGION_TOP(reg) PIXREGION_BOX (reg, (reg)->data->numRects)
 #define PIXREGION_END(reg) PIXREGION_BOX (reg, (reg)->data->numRects - 1)
 
-#define GOOD(reg) assert (PREFIX (_selfcheck) (reg))
+#define GOOD_RECT(rect) ((rect)->x1 < (rect)->x2 && (rect)->y1 < (rect)->y2)
+#define BAD_RECT(rect) ((rect)->x1 > (rect)->x2 || (rect)->y1 > (rect)->y2)
+
+#define GOOD(reg)
 
 static const box_type_t PREFIX (_empty_box_) = { 0, 0, 0, 0 };
 static const region_data_type_t PREFIX (_empty_data_) = { 0, 0 };
@@ -344,12 +347,23 @@
     region->extents.x2 = x + width;
     region->extents.y2 = y + height;
 
+    if (!GOOD_RECT (®ion->extents))
+    {
+        PREFIX (_init) (region);
+        return;
+    }
+
     region->data = NULL;
 }
 
 PIXMAN_EXPORT void
 PREFIX (_init_with_extents) (region_type_t *region, box_type_t *extents)
 {
+    if (!GOOD_RECT (extents))
+    {
+        PREFIX (_init) (region);
+        return;
+    }
     region->extents = *extents;
 
     region->data = NULL;
@@ -1292,14 +1306,16 @@
 {
     region_type_t region;
 
-    if (!width || !height)
- return PREFIX (_copy) (dest, source);
-    
     region.extents.x1 = x;
     region.extents.y1 = y;
     region.extents.x2 = x + width;
     region.extents.y2 = y + height;
 
+    if (!GOOD_RECT (®ion.extents))
+    {
+ return PREFIX (_copy) (dest, source);
+    }
+    
     region.data = NULL;
 
     return PREFIX (_union) (dest, source, ®ion);
@@ -2236,8 +2252,7 @@
 {
     GOOD (region);
 
-    assert (box->x1 <= box->x2);
-    assert (box->y1 <= box->y2);
+    assert (GOOD_RECT (box));
 
     region->extents = *box;


Parent Message unknown Re: xsrc/42281: X-server crash when using ms-ttf package

by Jeremy C. Reed :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The following reply was made to PR xsrc/42281; it has been noted by GNATS.

From: "Jeremy C. Reed" <reed@...>
To: gnats-bugs@...
Cc: uwe_debbug@...
Subject: Re: xsrc/42281: X-server crash when using ms-ttf package
Date: Sat, 7 Nov 2009 17:20:04 -0600 (CST)

 Since this is "external" software can you also check if is fixed
 upstream?
 
 Maybe check
 http://cgit.freedesktop.org/pixman/tree/pixman/
 
 And report upstream if needed.
 https://bugs.freedesktop.org/buglist.cgi?query_format=specific&order=relevance+desc&bug_status=__open__&product=&content=pixman
 

Parent Message unknown Re: xsrc/42281: X-server crash when using ms-ttf package

by Uwe KrÃŒger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The following reply was made to PR xsrc/42281; it has been noted by GNATS.

From: Uwe =?iso-8859-1?q?Kr=FCger?= <uwe_debbug@...>
To: gnats-bugs@...
Cc:
Subject: Re: xsrc/42281: X-server crash when using ms-ttf package
Date: Sun, 8 Nov 2009 02:44:58 +0100

 I've checked the files: the issue is fixed upstream so there is no need to
 report an error there.
 
 Regards,
 Uwe
 
 On Sunday 08 November 2009 00:25:01 Jeremy C. Reed wrote:
 >  Since this is "external" software can you also check if is fixed
 >  upstream?