From: Ilia Alshanetsky Date: Wed, 19 Oct 2005 14:11:56 +0000 (+0000) Subject: MFH: Fixed bug #34623 (Crash in pdo_mysql on longtext fields). X-Git-Tag: php-5.1.0RC4~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d0439e4879ec9b1f6b6120ef0b45ffc1dc02e2f;p=php MFH: Fixed bug #34623 (Crash in pdo_mysql on longtext fields). --- diff --git a/NEWS b/NEWS index f878411df6..e0baf0c5dd 100644 --- 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) diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index f48f6da9a1..98d3990fd6 100755 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -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",