Bug #68544 [NEW]: Mysql fails with compression active and big random data
From: bwoebi
Operating system: Irrelevant
PHP version: Irrelevant
Package: MySQLi related
Bug Type: Bug
Bug description:Mysql fails with compression active and big random data
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 bug report at https://bugs.php.net/bug.php?id=68544&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68544&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68544&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68544&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68544&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68544&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68544&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68544&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68544&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68544&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68544&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68544&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68544&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68544&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68544&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68544&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68544&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68544&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68544&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68544&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68544&r=mysqlcfg
Thread (3 messages)
- bwoebi@php.net