[GRASS-dev] [bug #5341] (grass) v.db.select: segfault

Brad Douglas rez at touchofmadness.com
Tue Nov 28 09:51:25 EST 2006


On Tue, 2006-11-28 at 12:25 +0100, Maciek Sieczka via RT wrote:
> hamish_nospam at yahoo.com wrote (Tue, Nov 28 2006 00:13:48):
> 
> Hamish and All,
> 
> Thanks for the hints!
> 
> I did some (cough)de(cough)bugging. I have put the coredump for others to try:
> http://kufaya.googlepages.com/core.bz2
> 
> To use it:
> 
> $ grass63 (any location)
> $ gdb v.db.select core
> 
> (gdb) bt
> #0  0xb76b3943 in free () from /lib/tls/i686/cmov/libc.so.6
> #1  0xb76b4a86 in realloc () from /lib/tls/i686/cmov/libc.so.6
> #2  0xb7f50069 in db_realloc (s=0x38, n=1293960530) at alloc.c:76
> #3  0xb7f53e12 in db_enlarge_string (x=0xbfc9bfd8, len=134832184)
>     at string.c:133
> #4  0xb7f5407f in db_append_string (x=0xbfc9bfd8,
>     s=0x8096040 " WHERE MAPS_COVER='built up'") at string.c:220
> #5  0x080494ee in main (argc=3, argv=0x8096040) at main.c:122
> (gdb)
> 
> 
> 
> Below is the code where it segfaults (frame #5, I guess):
> 
> (gdb) l
> 122            db_append_string ( &sql, buf );
> 123         }
> 124
> 125         if (db_open_select_cursor(driver, &sql, &cursor, DB_SEQUENTIAL) !=
> DB_OK)
> 126             G_fatal_error(_("Cannot open select cursor"));
> 127
> 128         table = db_get_cursor_table (&cursor);
> 129         ncols = db_get_table_number_of_columns (table);
> 130
> 131         /* column names if horizontal output */
> (gdb)
> 
> Any good? The coredump is available, anybody savvy can try themselves.

The problem is with db_append_string().  I just committed a patch that
handles memory properly before the call, but I don't know if it will be
of any help.  Give it a try.


-- 
Brad Douglas <rez touchofmadness com>                    KB8UYR/6
Address: 37.493,-121.924 / WGS84    National Map Corps #TNMC-3785




More information about the grass-dev mailing list