ports/122924: XCreateImage fails in most recent x11/XOrg

Dorr H. Clark dclark at engr.scu.edu
Wed Oct 8 08:21:33 UTC 2008


Bug Number 122924: XcreateImage fails in most recent x11/XOrg

This is actually not a bug in FreeBSD, in fact during the investigation
of this bug we were able to reproduce it on Linux (although at a higher
level).

To resolve a bug in XOrg file, we need to have the source files for XOrgalong 
with the mandatory external dependencies.  Code changes have been made in file 
ImUtil.c in directory /usr/ports/distfiles/xorg/lib/libX11-1.1.3/src
and at the bottom of this writeup is an explanation of how to retrieve
the software needed for investigating this bug.

The function XCreateImage takes image_bytes_per_line as one of the inputs. 
This parameter determines the value for Number of bytes between a pixel 
on one line and the pixel with the same X coordinate on the next line.
In case the calling function sets this parameter to 0, XCreateImage 
calculates the minimum value for image_bytes_per_line depending upon 
the format of image and the required depth.
Thus, if the input value for image_bytes_per_line is zero or less than 
the minimum value, it is set equal to the minimum value.

Here is the patch:

--- ImUtil_org.c	2008-08-21 12:46:15.000000000 +0000
+++ ImUtil.c	2008-08-21 12:47:37.000000000 +0000
@@ -372,10 +372,8 @@
 	    min_bytes_per_line =
 	        ROUNDUP((width + offset), image->bitmap_pad);
 	}
-	if (image_bytes_per_line == 0 ) {
+	if (image_bytes_per_line == 0 ||image_bytes_per_line < min_bytes_per_line  ) {
 	    image->bytes_per_line = min_bytes_per_line;
-	} else if (image_bytes_per_line < min_bytes_per_line) {
-		return 0;
 	} 
 	else {
 	    image->bytes_per_line = image_bytes_per_line;


Shikha Bansal , engineer
Dorr H. Clark, advisor
Graduate School of Engineering
Santa Clara University,
Santa Clara CA

http://www.cse.scu.edu/~dclark/coen_284_FreeBSD/122924.txt

1) GET THE XORG SOURCES 
	a)	cd /usr/ports/x11/xorg
	b)	make (you must be connected to internet)
   This copies the source files into /usr/ports/distfiles

2) GET THE EXTERNAL DEPENDENCIES
	a)	go to xcb.freedesktop.org/dist/
	b)	Download libxcb-0.9.93.tar.gz and xcb-proto-0.9.93.tar.gz in directory /usr/ports/distfiles/xorg/lib
	c)	cd xcb-proto-0.9.93 
	d)	make
	e)	cp *.pc /usr/local/libdata/pkgconfig
	f)	make install
	g)	similarly install libxcb-0.9.93

3)  INSTALL XORG AS A PORT
	a)	cd /usr/ports/distfiles/xorg/lib/libX11-1.1.3/include
	b)	mkdir xcb
	c)	copy the following 4 headers from libxcb-0.9.93 to xcb folder created in previous step:
	xcb.h,xproto.h,xcbext.h,xcblib.h
	d)	make install

 






More information about the freebsd-x11 mailing list