Bug #68350 [Com]: SQL_DESC_OCTET_LENGTH not supported by ADS ODBC driver
| From: | frederic dot marchal at wowtechnology dot com | Date: | Sat, 11 Apr 2015 17:21:50 +0000 |
| Subject: | Bug #68350 [Com]: SQL_DESC_OCTET_LENGTH not supported by ADS ODBC driver | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191979@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68350&edit=1
ID: 68350
Comment by: frederic dot marchal at wowtechnology dot com
Reported by: frederic dot marchal at wowtechnology dot com
Summary: SQL_DESC_OCTET_LENGTH not supported by ADS ODBC
driver
Status: Feedback
Type: Bug
Package: ODBC related
PHP Version: 5.4.34
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I assume this is the very last php_odbc.c file:
https://github.com/php/php-src/blob/master/ext/odbc/php_odbc.c
Then, no, the problem isn't fixed. You can see, at line 994, that the return code rc is
ignored. The problem I face is that the ODBC driver doesn't support SQL_DESC_OCTET_LENGTH. The
ODBC driver rightfully returns an error code when PHP queries that attribute. As PHP doesn't
check the return code it continues with the uninitialized displaysize and tries to emalloc a memory
block with a size of whatever happen to be in displaysize. You can see the result in my initial
report.
You should have a look at the patch I supplied. It has been included in Debian and, so far, it works
fine.
Previous Comments:
------------------------------------------------------------------------
[2015-04-11 16:46:06] cmb@php.net
I assume the actual reason for the misbehavior is bug #68087, which
has already been fixed in 5.5.19 and 5.6.3, but will not be fixed
for PHP 5.4.
Can you please confirm that?
------------------------------------------------------------------------
[2014-11-05 12:48:42] frederic dot marchal at wowtechnology dot com
Description:
------------
Running odbc_exec() on an ADS ODBC driver version 11.0 or 11.1 for Linux produces errors such as:
PHP Fatal error: Out of memory (allocated 524288) (tried to allocate 12415340535808218625 bytes) in
SybaseClass.php on line 127
The error is produced because libadsodbc.so returns an invalid value when SQLColAttributes is
queried with SQL_DESC_OCTET_LENGTH.
It worked before this commit:
https://github.com/php/php-src/commit/7301994c28d548c5a4eda6a3a4ae0fab6af04636
The patch simply checks the return value from SQLColAttributes and falls back on the old method to
get the column size.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68350&edit=1