[GRASS-dev] Segmentation fault i.smap

Markus Neteler neteler at osgeo.org
Tue Jun 29 11:12:09 EDT 2010


On Tue, Jun 29, 2010 at 4:38 PM, Glynn Clements
<glynn at gclements.plus.com> wrote:
>
> 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.

That's indeed true (I am debugging data of a colleague, apparently his
i.gensigset
run failed unnoticed):

cat sig_22_1684
title: Labels
nbands: 17

The "only" thing to do seems to catch such error of "emtpy" signature
file without
crashing.

Markus


More information about the grass-dev mailing list