[GRASS-dev] Segmentation fault i.smap
Glynn Clements
glynn at gclements.plus.com
Tue Jun 29 10:38:13 EDT 2010
Markus Neteler wrote:
> using i.smap, I get a segfault:
> #0 0x000000000040295d in write_img (img=0x75e950, ncols=210,
> nrows=215, S=0x7fff87ab2a60, parms=0x7fff87ab2ba0,
> files=0x7fff87ab2a80) at write_img.c:23
> class = 0
> row = 0
> col = 0
> I don't see the problem in the backtrace output... ("isdata" looks strange?).
You would need to look at the structures referenced by "S" and
"files"; the pointers alone don't suffice.
> It crashes in i.smap/shapiro/write_img.c line 23:
> files->outbuf[col] = (CELL) S->ClassSig[class].classnum;
> #2 0x000000000040216b in main (argc=5, argv=0x7fff87ab2cc8) at main.c:48
> S = {nbands = 17, nclasses = 0, title = 0x74c320 " Labels",
> ClassSig = 0x0}
It looks like S->ClassSig is NULL, hence the segfault.
This suggests that the sigset file doesn't have a "class:" tag or is
broken.
main() calls read_signatures(), which calls I_ReadSigSet(). This calls
I_InitSigSet(), which initialises the ClassSig field to NULL, then
processes the tags. If it finds a "class:" tag, it calls get_class()
which calls I_NewClassSig(), which sets the ClassSig field.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list