Re: segfault in SQLSpecialColumns when table name is null string

From: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>
To: tenger(at)iseries-guru(dot)com
Cc: pgsql-odbc(at)postgresql(dot)org, lionel(at)mamane(dot)lu
Subject: Re: segfault in SQLSpecialColumns when table name is null string
Date: 2012-07-11 21:41:18
Message-ID: 4FFDF2FE.2080502@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi Terrence,

(2012/07/10 21:22), Terrence Enger wrote:
> 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.

Seems a real cause of the problem.
I would fix it and commit the change to CVS soon.

regards,
Hiroshi Inoue

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Nelson Manuel Marques 2012-07-12 19:11:02 Questions regarding versioning
Previous Message Lionel Elie Mamane 2012-07-10 14:27:07 Re: segfault in SQLSpecialColumns when table name is null string