com php-src: Fixed bug #69381 out of memory with sage odbc driver: ext/odbc/php_odbc.c
| From: | Anatol Belski | Date: | Tue, 28 Apr 2015 13:08:53 +0000 |
| Subject: | com php-src: Fixed bug #69381 out of memory with sage odbc driver: ext/odbc/php_odbc.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86537@lists.php.net to get a copy of this message | ||
Commit: f505d112074d7d0693ee6829945865b4788f777f
Author: Frederic Marchal <frederic.marchal@wowtechnology.com> Tue, 28 Apr 2015
15:08:53 +0200
Committer: Anatol Belski <ab@php.net> Tue, 28 Apr 2015 15:08:53 +0200
Parents: 768bbedf8233dad6c1709b536f8db20d4496a7cc
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f505d112074d7d0693ee6829945865b4788f777f
Log:
Fixed bug #69381 out of memory with sage odbc driver
This is just a hotfix as there are still drivers with no full
ODBC 3.x support. This patch origins from bug #68350 which was
solved by the proper 3.0 migration, another driver (Sage)
turned out to have the real issue.
Bugs:
https://bugs.php.net/69381
https://bugs.php.net/68350
Changed paths:
M ext/odbc/php_odbc.c
Diff:
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 231e814..ddfbc4e 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -999,6 +999,15 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
default:
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), colfieldid,
NULL, 0, NULL, &displaysize);
+#if defined(ODBCVER) && (ODBCVER >= 0x0300)
+ if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO && colfieldid ==
SQL_DESC_OCTET_LENGTH) {
+ /* This is a quirk for ODBC 2.0 compatibility for broken driver implementations.
+ */
+ charextraalloc = 1;
+ rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE,
+ NULL, 0, NULL, &displaysize);
+ }
+#endif
/* Workaround for Oracle ODBC Driver bug (#50162) when fetching TIMESTAMP column */
if (result->values[i].coltype == SQL_TIMESTAMP) {
displaysize += 3;