Segmentation fault on XpmCreateImageFromData(3)

Phillip Bushee phillbush at cock.li
Wed Mar 24 23:12:34 UTC 2021


I'm am writing a window manager which uses XpmCreateImageFromData(3)
to read a .xpm file containing the theme of the decoration of the
windows.  The program segfaults when calling this function.  I use this
function rather than XpmCreatePixmapFromData(3) in order for me to get
a pixel color from the .xpm with XGetPixel(3).

This is the code of the window manager:
	https://github.com/phillbush/shod/blob/master/shod.c

This is the .xpm I am reading:
	https://github.com/phillbush/shod/blob/master/theme.xpm

This is what I get running the program under gdb.

	GNU gdb 6.3
	Copyright 2004 Free Software Foundation, Inc.
	GDB is free software, covered by the GNU General Public License, and 
you are
	welcome to change it and/or distribute copies of it under certain 
conditions.
	Type "show copying" to see the conditions.
	There is absolutely no warranty for GDB.  Type "show warranty" for 
details.
	This GDB was configured as "amd64-unknown-openbsd6.8"...
	(gdb) run
	Starting program: /home/phil/proj/shod/shod
	Error while reading shared library symbols:
	Dwarf Error: wrong version in compilation unit header (is 4, should be 
2) [in module /usr/libexec/ld.so]
	Error while reading shared library symbols:
	Dwarf Error: wrong version in compilation unit header (is 4, should be 
2) [in module /usr/libexec/ld.so]
	Error while reading shared library symbols:
	Dwarf Error: wrong version in compilation unit header (is 4, should be 
2) [in module /usr/libexec/ld.so]
	Error while reading shared library symbols:
	Dwarf Error: wrong version in compilation unit header (is 4, should be 
2) [in module /usr/libexec/ld.so]
	Error while reading shared library symbols:
	Dwarf Error: wrong version in compilation unit header (is 4, should be 
2) [in module /usr/libexec/ld.so]

	Program received signal SIGSEGV, Segmentation fault.
	0x00007f7fffff2600 in ?? ()
	(gdb) bt
	#0  0x00007f7fffff2600 in ?? ()
	#1  0x00000960a406b734 in SetColor () from /usr/X11R6/lib/libXpm.so.9.0
	#2  0x00000960a4067ce6 in CreateColors () from 
/usr/X11R6/lib/libXpm.so.9.0
	#3  0x00000960a4069916 in xpmParseDataAndCreate () from 
/usr/X11R6/lib/libXpm.so.9.0
	#4  0x00000960a4065437 in XpmCreateImageFromData () from 
/usr/X11R6/lib/libXpm.so.9.0
	#5  0x0000095e5e85f5db in settheme () at shod.c:473
	#6  0x0000095e5e85bb58 in main () at shod.c:3465

I'm running OpenBSD Xenocara.
This is what I get running `X -version`:

	X.Org X Server 1.20.8
	X Protocol Version 11, Revision 0
	Build Operating System: OpenBSD 6.8 amd64
	Current Operating System: OpenBSD thinkbsd.my.domain 6.8 GENERIC.MP#5 
amd64
	Build Date: 24 November 2020  06:57:35AM

	Current version of pixman: 0.38.4
	        Before reporting problems, check http://wiki.x.org
	        to make sure that you have the latest version.



More information about the xorg mailing list