segfault in SQLSpecialColumns when table name is null string - Mailing list pgsql-odbc

From Terrence Enger
Subject segfault in SQLSpecialColumns when table name is null string
Date
Msg-id 1341922972.25065.19.camel@cougar-natty
Whole thread Raw
Responses Re: segfault in SQLSpecialColumns when table name is null string
Re: segfault in SQLSpecialColumns when table name is null string
List pgsql-odbc
Greetings,

This message arises from LibreOffice bug report
"SIGSEGV: ODBC to PostgreSQL, renaming column in SELECT list"
<https://bugs.freedesktop.org/show_bug.cgi?id=50849>, but I shall try
not to make you read that report.

Working with PostgreSQL version 8.4.12-0ubuntu11.04 and with ODBC
driver versions 1:08.03.0200-1.2 (supplied with ubuntu-natty (11.04))
and pgsqlodbc-09.01.0100 (built locally), I have managed to provoke a
segfault by calling SQLSpecialColumns with a null string for the table
name.  This call is, of course, a strange thing to do, and I cannot
imagine any good result.  Still, a segfault seems a disproportionate
punishment for doing something silly.

The segfault happens in SQLSpecialColumns at odbcapi.c line 790, which reads
    if (SQL_SUCCESS == ret && 0 == QR_get_num_total_tuples(SC_get_Result(stmt)))
The condition tries to dereference stmt->result, which is NULL.

Along the way to this result, PGAPI_SpecialColumns at info.c lines
2783 through 2786 detects the bad table name and does an early return.
But the return value SQL_SUCCESS seems wrong.  When I used gdb to
fudge the return value to SQL_ERROR, there was no segfault.

Do you need more information?  Can I do something else to help?

Thank you, all for your attention.
Terry.


( I tried earlier to send this message before my address was
subscribed, and that earlier attempt is waiting for moderation.  If
this attempt gets through, I shall ask to moderator to cancel the
first attempt.  I apologize for the duplication or confusion. )



pgsql-odbc by date:

Previous
From: Maziar Navahan
Date:
Subject: Re: can not configure in centos 6 x64
Next
From: Lionel Elie Mamane
Date:
Subject: Re: segfault in SQLSpecialColumns when table name is null string