grass-addons icon indicating copy to clipboard operation
grass-addons copied to clipboard

[Bug] v.percolate without option "id=" makes it crash (segfault)

Open neteler opened this issue 4 years ago • 3 comments

Hi. I found that running v.percolate without option "id=" makes it crash (segfault). Weirdly, I should not even be able to run it without that option: The module interface description says that "id=" is required.

But it seems to have a default value that points to unallocated memory.

This is what valgrind says: Invalid read of size 8 at 0x4B1E383: db_close_database (in /opt/grass/lib/libgrass_dbmiclient.7.8.so) by 0x4B2103E: db_close_database_shutdown_driver (in /opt/grass/lib/libgrass_dbmiclient.7.8.so) by 0x40526D: read_input_vector (vector.c:149) by 0x402749: main (main.c:268) Address 0x310 is not stack'd, malloc'd or (recently) free'd

Originally posted by @benducke in https://github.com/OSGeo/grass-addons/issues/382#issuecomment-791526427

neteler avatar Mar 05 '21 23:03 neteler

Can you please check, @mwlake ? Thanks

neteler avatar Mar 05 '21 23:03 neteler

By default, a G_OPT_V_FIELD option gets assigned 1, but @mwlake might have wanted to explicitly require it by clearing it out, but input_id->answer = NULL; should be the right way, not an empty string.

HuidaeCho avatar Mar 07 '21 06:03 HuidaeCho

Thanks @benducke. I can replicate this and will look to fix it this week.

mwlake avatar Mar 08 '21 10:03 mwlake