From: Terrence Enger <tenger@iseries-guru.com>
To: pgsql-odbc@postgresql.org
Cc: lionel@mamane.lu
Subject: segfault in SQLSpecialColumns when table name is null string
Date: Tue, 10 Jul 2012 08:22:52 -0400
Message-ID: <1341922972.25065.19.camel@cougar-natty> (raw)
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. )
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: tenger@iseries-guru.com, lionel@mamane.lu
Subject: Re: segfault in SQLSpecialColumns when table name is null string
In-Reply-To: <1341922972.25065.19.camel@cougar-natty>
References: <1341922972.25065.19.camel@cougar-natty>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox