Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkW6p-0001op-J0 for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 10:08:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WkW6o-0007pC-QI for pgsql-odbc@arkaria.postgresql.org; Wed, 14 May 2014 10:08:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkW6o-0007p5-75 for pgsql-odbc@postgresql.org; Wed, 14 May 2014 10:08:22 +0000 Received: from mail.lurcherlink.org ([217.34.199.121] helo=mail.lurcher.org) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkW6h-0003HX-Fx for pgsql-odbc@postgresql.org; Wed, 14 May 2014 10:08:21 +0000 Received: from [172.20.0.153] (hul.easysoft.local [172.20.0.153]) by mail.lurcher.org (8.14.3/8.12.8) with ESMTP id s4EA83cx008267 for ; Wed, 14 May 2014 11:08:03 +0100 Message-ID: <5373408E.2070404@lurcher.org> Date: Wed, 14 May 2014 11:08:14 +0100 From: Nick Gorham User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: Re: ODBC : SQLGetData question References: <53730FFB.5020304@gmail.com> <53732D9D.1060605@gmail.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------050005000609040207040806" X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, HTML_MESSAGE autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sipserver.lurcher.org X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org This is a multi-part message in MIME format. --------------050005000609040207040806 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 14/05/14 10:07, Dev Kumkar wrote: > > On Wed, May 14, 2014 at 2:17 PM, aihtdikh > wrote: > > That will work around the issue, but I'm stumped as to why it was > not working for you already. > > It seems like your platform must be 64bit, and something somewhere > is converting what should be a 64bit SQLLEN into a 32bit value, > but I can't find anywhere in the source that does anything unsafe > in this regard - it's SQLLEN all the way. > > Edit: Ah, Nick may be on the right path there. > Could the driver have been compiled with a different sqltypes.h > than the application? > If so, you could try compiling the driver under the same setup as > your application to see if that fixes it. > > > Regards, > Harun > > Yes, the platform is 64-bit. > We are deploying the driver as it is and not compiling it in-house > currently. In that case compile the application with the same setup as the driver. > > Do you see any issues with the (int) typecast done for SQLLEN? Yes, if your app ever expects the driver to return an array of results (for example) it will go badly wrong very quickly. Also, if the driver is 64 bit SQLLEN and the application 32 bit, a SQLGetData will be writing to memory that happens to be after the indicator variable, that will not end well. -- Nick --------------050005000609040207040806 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
On 14/05/14 10:07, Dev Kumkar wrote:

On Wed, May 14, 2014 at 2:17 PM, aihtdikh <aihtdikh@gmail.com> wrote:
That will work around the issue, but I'm stumped as to why it was not working for you already.

It seems like your platform must be 64bit, and something somewhere is converting what should be a 64bit SQLLEN into a 32bit value, but I can't find anywhere in the source that does anything unsafe in this regard - it's SQLLEN all the way.

Edit: Ah, Nick may be on the right path there.
Could the driver have been compiled with a different sqltypes.h than the application?
If so, you could try compiling the driver under the same setup as your application to see if that fixes it.


Regards,
Harun
Yes, the platform is 64-bit.
We are deploying the driver as it is and not compiling it in-house currently.

In that case compile the application with the same setup as the driver.

Do you see any issues with the (int) typecast done for SQLLEN?

Yes, if your app ever expects the driver to return an array of results (for example) it will go badly wrong very quickly. Also, if the driver is 64 bit SQLLEN and the application 32 bit, a SQLGetData will be writing to memory that happens to be after the indicator variable, that will not end well.

--
Nick
--------------050005000609040207040806--