Project

General

Profile

Bug #154

xpm2ps segmentation fault

Added by Nicholas Breen over 12 years ago. Updated about 12 years ago.

Status:
Closed
Priority:
Normal
Category:
analysis tools
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

Passing along a bug report from the Debian package (full report at the URL given):

-------------
$ xpm2ps f bug.xpm -xpm bug.xpm -o -rainbow red
(many lines deleted)
Using white for color "gray57",
There are 1 matrices in bug.xpm
Matrix 0 is 100 x 100
Segmentation fault
------------

I think this is another gcc-4.x quirk, as it reoccurs on i386 when compiled with
either gcc-4.1 or 4.2, but does not happen on a MIPS system compiled with 4.1,
nor with a static build using 4.1 on i386.

Backtrace from a debugging build:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1487410976 (LWP 2917)]
get_einp (ninp=0xafe36164, inp=<value optimized out>, name=0xa7f1d215
"black&white") at readinp.c:185
185 (*inp)[i].count = inp_count++;
(gdb) bt
#0 get_einp (ninp=0xafe36164, inp=<value optimized out>, name=0xa7f1d215
"black&white") at readinp.c:185
#1 0xa7b1fca5 in get_eeenum (ninp=0xafe36164, inp=0xafe36168, name=0xa7f1d215
"black&white",
defs=0xa7f29d30, nerror=0xafe36124, bPrintError=0) at readinp.c:256
#2 0xa7b1ff97 in get_eenum (ninp=0xafe36164, inp=0xafe36168, name=0xa7f1d215
"black&white",
defs=0xa7f29d30) at readinp.c:291
#3 0xa7ed5fdc in get_params (mpin=0x0, mpout=0x0, psr=0xafe362ec) at
gmx_xpm2ps.c:114
#4 0xa7ed6752 in ps_mat (outf=0x804a3e8 "plot.eps", nmat=1, mat=0x804a438,
mat2=0x0, bFrame=1, bDiag=1,
bFirstDiag=1, bTitle=1, bTitleOnce=0, bYonce=0, elegend=2, size=400, boxx=0,
boxy=0, m2p=0x0,
m2pout=0x0, mapoffset=0) at gmx_xpm2ps.c:652
#5 0xa7ed96e2 in do_mat (nmat=1, mat=0x804a438, mat2=0x0, bFrame=1,
bZeroLine=0, bDiag=1, bFirstDiag=1,
bTitle=1, bTitleOnce=0, bYonce=0, elegend=2, size=400, boxx=0, boxy=0,
epsfile=0x804a3e8 "plot.eps",
xpmfile=0x804a3c8 "bug.xpm", m2p=0x0, m2pout=0x0, skip=1, mapoffset=0) at
gmx_xpm2ps.c:1008
#6 0xa7eda2ab in gmx_xpm2ps (argc=1, argv=0xafe40854) at gmx_xpm2ps.c:1264
#7 0x080484ff in main (argc=Cannot access memory at address 0x0
) at xpm2ps.c:50

bug.xpm (11.8 KB) bug.xpm Crash-causing xpm file Nicholas Breen, 06/14/2007 10:54 PM

History

#1 Updated by Nicholas Breen over 12 years ago

Created an attachment (id=202)
Crash-causing xpm file

#2 Updated by David van der Spoel about 12 years ago

I've tried this on a number of machines with different OS and compilers (all gcc 4.1.x) and could not reproduce it. The debian package does have this problem however. I'll try with shared libraries enabled now. Indeed, using shared libraries makes it crash. More later.

#3 Updated by David van der Spoel about 12 years ago

Fixed it by initializing ninp=0 on line 108 of src/tools/gmx_xpm2ps.c

Also available in: Atom PDF