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: 2020-10-15 13:03 UTC
From: bwoebi@php.net Assigned: nikic (profile)
Status: Closed Package: MySQLi related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bwoebi@php.net
New email:
PHP Version: OS:

 

 [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
 [2017-10-24 08:14 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: mysql +Assigned To:
 [2020-10-15 13:03 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2020-10-15 13:03 UTC] nikic@php.net
This was fixed a while ago by https://github.com/php/php-src/pull/6144.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC