]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #34623 (Crash in pdo_mysql on longtext fields).
authorIlia Alshanetsky <iliaa@php.net>
Wed, 19 Oct 2005 14:11:56 +0000 (14:11 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 19 Oct 2005 14:11:56 +0000 (14:11 +0000)
NEWS
ext/pdo_mysql/mysql_statement.c

diff --git a/NEWS b/NEWS
index f878411df6d7bc6ddf2822e410e57615d81fe884..e0baf0c5ddd6bdb66330f7896e97e6a256eb8da5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,9 @@ PHP                                                                        NEWS
 - Fixed bug #34905 (Digest authentication does not work with Apache 1). (Ilia)
 - Fixed bug #34902 (mysqli::character_set_name() - undefined method). (Tony)
 - Fixed bug #34899 (Fixed sqlite extension compile failure). (Ilia)
-- Fixed bug #33829 (mime_content_type() returns text/plain for gzip and bzip files). (Derick)
+- Fixed bug #33829 (mime_content_type() returns text/plain for gzip and bzip 
+  files). (Derick)
+- Fixed bug #34623 (Crash in pdo_mysql on longtext fields). (Ilia)
 
 17 Oct 2005, PHP 5.1 Release Candidate 3
 - Fixed bug #34873 (Segmentation Fault on foreach in object). (Dmitry)
index f48f6da9a1bc485c8d38277b643855b0d9d8d56c..98d3990fd6250de55aa93199f8006929278527a8 100755 (executable)
@@ -71,6 +71,8 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
        return 1;
 }
 
+#define PDO_MYSQL_MAX_BUFFER 1024*1024 /* 1 megabyte */
+
 static int pdo_mysql_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
 {
        pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
@@ -141,6 +143,10 @@ static int pdo_mysql_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
                                                        S->bound_result[i].buffer_length =
                                                                S->fields[i].max_length? S->fields[i].max_length:
                                                                S->fields[i].length;
+                                                       /* work-around for longtext and alike */
+                                                       if (S->bound_result[i].buffer_length > PDO_MYSQL_MAX_BUFFER) {
+                                                               S->bound_result[i].buffer_length = PDO_MYSQL_MAX_BUFFER;
+                                                       }
                                        }
 #if 0
                                        printf("%d: max_length=%d length=%d buffer_length=%d type=%d\n",