php.net |  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: 2014-12-03 20:08 UTC
From: bwoebi@php.net Assigned: mysql
Status: Assigned Package: MySQLi related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-03 20:03 UTC] bwoebi@php.net
-Assigned To: +Assigned To: mysql
 [2014-12-03 20:08 UTC] bwoebi@php.net
-Summary: Mysql fails with compression active and big random data +Summary: Mysqlnd fails with compression active and big random data
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Fri Mar 24 20:01:40 2017 UTC