Bug #68544 [Opn->Csd]: Mysqlnd fails with compression active and big random data

From: Date: Thu, 15 Oct 2020 13:03:20 +0000
Subject: Bug #68544 [Opn->Csd]: Mysqlnd fails with compression active and big random data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229642@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68544&edit=1 ID: 68544 Updated by: nikic@php.net Reported by: bwoebi@php.net Summary: Mysqlnd fails with compression active and big random data -Status: Open +Status: Closed Type: Bug Package: MySQLi related Operating System: Irrelevant PHP Version: Irrelevant -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: This was fixed a while ago by https://github.com/php/php-src/pull/6144. Previous Comments: ------------------------------------------------------------------------ [2014-12-03 20:03:09] bwoebi@php.net Description: ------------ If the compressed packet payload is bigger than 0xffffff (because DEFLATE increased the size), then the payload length will overflow on 24 bit boundary and PHP ends up with a warning and fails. Test script: --------------- ini_set("memory_limit", "1G"); $db = mysqli_init(); $db->real_connect(HOST, USER, PASS, DB, 3306, null, MYSQL_CLIENT_COMPRESS); $q = $db->prepare("INSERT INTO tmp (text) VALUES (?)"); $n = null; $q->bind_param('b', $n); $x = file_get_contents("/dev/urandom", 0, null, -1, 0xffffff - 1); $q->send_long_data(0, $x); $q->execute(); Expected result: ---------------- Successful insert in database... Actual result: -------------- Warning: Error while sending STMT_SEND_LONG_DATA packet. PID=%d in %s on line %d (Doesn't matter if QUERY, PREPARE or STMT_SEND_LONG_DATA packet or what ever; issue is always the same.) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68544&edit=1

« previous php.bugs (#229642) next »