pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank van der Aa - Vanboxtel BV <fvdaa@vanboxtel.nl>
To: hlinnaka@iki.fi
To: pgsql-odbc@postgresql.org
Subject: Re: PGSQL ODBC driver crash in CC_get_current_schema
Date: Mon, 13 Apr 2015 12:08:45 +0200
Message-ID: <552B95AD.4010506@vanboxtel.nl> (raw)
In-Reply-To: <5526CB48.60606@iki.fi>
References: <5524EBEE.2090603@vanboxtel.nl>
	<5526CB48.60606@iki.fi>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

Hi Heikki,

thank you for adding additional fixes to solve this problem.

Do you have any idea when the next official release will be that 
includes this change?

Met vriendelijke groeten / Kind regards,

Frank van der Aa

Vanboxtel BV

T 	+31 (0) 492 327 333
F 	+31 (0) 492 324 326
E 	fvdaa@vanboxtel.nl <mailto:fvdaa@vanboxtel.nl>
I 	www.vanboxtel.nl <http://www.vanboxtel.nl/;


Heikki Linnakangas schreef op 9-4-2015 om 20:56:
> On 04/08/2015 11:50 AM, Frank van der Aa - Vanboxtel BV wrote:
>> Hi,
>>
>> we are using the PostgreSQL 9.2.4 with ODBC driver 09.03.0400.
>>
>> We experience a driver crash when, for some reason (e.g. insufficient
>> permissions), there is no schema set.
>>
>> This happens because the strdup in the CC_get_current_schema function in
>> connection.c is executed while the 'select current_schema()' query
>> returned NULL.
>>
>> We have created a patch to workaround the strdup when the result of
>> QR_get_value_backend_text is NULL:
>>
>> # diff connection.c.orig connection.c
>> 4073c4073,4081
>> <                               conn->current_schema =
>> strdup(QR_get_value_backend_text(res, 0, 0));
>> ---
>>   >                       {
>>   >                               const char* value =
>> QR_get_value_backend_text(res, 0, 0);
>>   >
>>   >                               if (value == NULL)
>>   > conn->current_schema = NULL;
>>   >                               else
>>   > conn->current_schema = strdup(value);
>>   >
>>   >                       }
>>
>> We have tested this patch in our environment and didn't experience any
>> problems. However, we don't oversee the entire code, but expect this not
>> to give any more problems.
>
> Hmm. That's not a very complete fix. Not all of the callers of 
> CC_get_current_schema() check for a NULL, so you'll still get a 
> segfault in the caller in some cases. Also, the NULL current_schema 
> value should be cached like a valid value, otherwise the driver will 
> call current_schema() repeatedly.
>
> Committed. I did those additional fixes, and added a test case to the 
> regression suite. Thanks for the report!
>
> - Heikki
>


Vanboxtel BV - Kerkstraat 4 - 5427 BC Boekel - KvK 16051676

view thread (4+ messages)  latest in thread

Message-ID: <552B95AD.4010506@vanboxtel.nl>
Permalink:  ../552B95AD.4010506@vanboxtel.nl/
Also on:    postgresql.org/message-id/552B95AD.4010506@vanboxtel.nl

 · 

reply

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: fvdaa@vanboxtel.nl, hlinnaka@iki.fi
  Subject: Re: PGSQL ODBC driver crash in CC_get_current_schema
  In-Reply-To: <552B95AD.4010506@vanboxtel.nl>
  References: <5524EBEE.2090603@vanboxtel.nl> <5526CB48.60606@iki.fi> <552B95AD.4010506@vanboxtel.nl>

* 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