[GRASS-dev] new v.in.geonames: problems with UTF-8 Unicode text

Markus Neteler neteler at osgeo.org
Thu Jul 3 03:45:41 EDT 2008


On Wed, Jul 2, 2008 at 6:43 PM, Glynn Clements <glynn at gclements.plus.com> wrote:
> Markus Neteler wrote:
...
>> (Un)related a segfault: When copying the map from the postgresql mapset
>> into the sqlite mapset, it crashes:
>>
>> # in SQLite mapset:
...
>> (gdb) r vect=it at postgresql,test --o
...
>> Program received signal SIGSEGV, Segmentation fault.
...
>> (gdb) bt full
>> #0  0x00002ab6aa9e8888 in db_execute_immediate
>> (driver=0xab8be18d88e1a38c, SQLstatement=0x7fff00de1240)
>>     at c_execute.c:16
>>         ret_code = 32767
>> #1  0x00002ab6aa9ea276 in db__copy_table (from_drvname=0x610420 "pg",
>
> [snip]
>
>>     nvals=-1846924119) at copy_tab.c:321
>
> At the top of db__copy_table (lib/db/dbmi_client/copy_tab.c) is:
>
>    char buf[1000];
>
> I suspect that this is overflowing at line 295:
>
> 294                     db_double_quote_string ( &value_string );
> 295                     sprintf (buf, "'%s'", db_get_string(&value_string) );
> 296                     db_append_string ( &sql, buf);
>
> I suggest:
>
>                        db_double_quote_string ( &value_string );
>                        db_append_string ( &sql, "'");
>                        db_append_string ( &sql, db_get_string(&value_string));
>                        db_append_string ( &sql, "'");
>

Perfect, this cures the problem.
Thanks a lot!

Markus


More information about the grass-dev mailing list