|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68544 Mysqlnd fails with compression active and big random data
Submitted: 2014-12-03 20:03 UTC Modified: 2017-10-24 08:14 UTC
From: Assigned:
Status: Open Package: MySQLi related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-12-03 20:03 UTC]
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);

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.)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-03 20:03 UTC]
-Assigned To: +Assigned To: mysql
 [2014-12-03 20:08 UTC]
-Summary: Mysql fails with compression active and big random data +Summary: Mysqlnd fails with compression active and big random data
 [2017-10-24 08:14 UTC]
-Status: Assigned +Status: Open -Assigned To: mysql +Assigned To:
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Sep 20 09:01:25 2020 UTC