php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32830 SQLBindCol on 64bit systems
Submitted: 2005-04-26 10:49 UTC Modified: 2005-05-10 15:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: cvn at interchain dot nl Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.*, 5.* OS: Linux
Private report: No CVE-ID: None
 [2005-04-26 10:49 UTC] cvn at interchain dot nl
Description:
------------
In the odbc extension SQLBindCol is called with a long int as last parameter (vallen from the odbc_result struct). This should be an SDWORD as is also used with SQLBindParameter (and the ODBC API says).

This is no problem on 32bit compiled versions, only on 64bit compiled PHP versions.

In short: the calls to SQLBindParameter in odbc.c are ok, the calls to SQLBindCol are not.

Only with negative values like SQL_NULL the problem arises, as the value is initialised at (long int) 0, but only 'half' (SDWORD) is written by the driver.

This error is not specific to a PHP version and is there since version 4.

Actual result:
--------------
When the SQLBindCol would return a negative value like SQL_NULL only 'half' of the long int vallen is written by the  driver, causing php to think the value is really high, and will dump core when accessing the output value.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-28 00:14 UTC] tony2001@php.net
Please provide a test case.
Or even a patch, as it seems that you know the extact problem and it's solution (diff -u would be fine).
 [2005-04-28 01:22 UTC] sniper@php.net
I would guess the patch is simply to change 'long int' to 'SDWORD' in ext/odbc/php_odbc_includes.h:233 ? (CVS HEAD branch)

 [2005-05-10 15:22 UTC] sniper@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 07 13:01:27 2024 UTC