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

From Hiroshi Inoue
Subject Re: segfault in SQLSpecialColumns when table name is null string
Date
Msg-id 4FFDF2FE.2080502@tpf.co.jp
Whole thread Raw
In response to segfault in SQLSpecialColumns when table name is null string  (Terrence Enger <tenger@iseries-guru.com>)
List 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

pgsql-odbc by date:

Previous
From: Lionel Elie Mamane
Date:
Subject: Re: segfault in SQLSpecialColumns when table name is null string
Next
From: Nelson Manuel Marques
Date:
Subject: Questions regarding versioning