nrk/phpiredis

Bug,

Opened this issue · 2 comments

Hi,
I use your library to complement Predis.
This bug occurs only on a Linux 64-bit

When i use the hmset function :

$client->hmset(1,"truc",2, "chose", 4, 'haaaaa', 1);

I've got this error :
*** glibc detected *** php: free(): invalid next size (fast): 0x00000000010ea720 ***
======= Backtrace: =========
/lib64/libc.so.6[0x38e227245f]
/lib64/libc.so.6(cfree+0x4b)[0x38e22728bb]
/usr/lib64/extensions/no-debug-non-zts-20090626/phpiredis.so(zif_phpiredis_format_command+0x288)[0x7fb6a2434a58]
php[0x7fdbcc]
php[0x7feaad]
php(execute+0x3b4)[0x7fcca3]
php(zend_call_function+0xe25)[0x7bd98a]
php(zend_call_method+0x3bd)[0x7e8cb5]
php(zend_std_call_user_call+0x205)[0x7f78d8]
php[0x7fdbcc]
php[0x7feaad]
php(execute+0x3b4)[0x7fcca3]
php(zend_execute_scripts+0x249)[0x7cdb58]
php(php_execute_script+0x3a3)[0x756819]
php[0x8b509c]
/lib64/libc.so.6(__libc_start_main+0xf4)[0x38e221d994]
php[0x4212f9]
======= Memory map: ========
00400000-00b8a000 r-xp 00000000 09:01 100623 /usr/local/bin/php
00d89000-00def000 rw-p 00789000 09:01 100623 /usr/local/bin/php
00def000-0110b000 rw-p 00000000 00:00 0 [heap]
3652c00000-3652c07000 r-xp 00000000 09:01 417794 /lib64/librt-2.5.so
3652c07000-3652e07000 ---p 00007000 09:01 417794 /lib64/librt-2.5.so
3652e07000-3652e08000 r--p 00007000 09:01 417794 /lib64/librt-2.5.so
3652e08000-3652e09000 rw-p 00008000 09:01 417794 /lib64/librt-2.5.so
38e1e00000-38e1e1c000 r-xp 00000000 09:01 418098 /lib64/ld-2.5.so
38e201c000-38e201d000 r--p 0001c000 09:01 418098 /lib64/ld-2.5.so
38e201d000-38e201e000 rw-p 0001d000 09:01 418098 /lib64/ld-2.5.so
38e2200000-38e234e000 r-xp 00000000 09:01 418099 /lib64/libc-2.5.so
38e234e000-38e254e000 ---p 0014e000 09:01 418099 /lib64/libc-2.5.so
38e254e000-38e2552000 r--p 0014e000 09:01 418099 /lib64/libc-2.5.so
38e2552000-38e2553000 rw-p 00152000 09:01 418099 /lib64/libc-2.5.so
38e2553000-38e2558000 rw-p 00000000 00:00 0
38e2600000-38e2602000 r-xp 00000000 09:01 418100 /lib64/libdl-2.5.so
38e2602000-38e2802000 ---p 00002000 09:01 418100 /lib64/libdl-2.5.so
38e2802000-38e2803000 r--p 00002000 09:01 418100 /lib64/libdl-2.5.so
38e2803000-38e2804000 rw-p 00003000 09:01 418100 /lib64/libdl-2.5.so
38e2a00000-38e2b33000 r-xp 00000000 09:01 125653 /usr/lib64/libxml2.so.2.6.26
38e2b33000-38e2d33000 ---p 00133000 09:01 125653 /usr/lib64/libxml2.so.2.6.26
38e2d33000-38e2d3c000 rw-p 00133000 09:01 125653 /usr/lib64/libxml2.so.2.6.26
38e2d3c000-38e2d3d000 rw-p 00000000 00:00 0
38e2e00000-38e2e3b000 r-xp 00000000 09:01 418109 /lib64/libsepol.so.1
38e2e3b000-38e303b000 ---p 0003b000 09:01 418109 /lib64/libsepol.so.1
38e303b000-38e303c000 rw-p 0003b000 09:01 418109 /lib64/libsepol.so.1
38e303c000-38e3046000 rw-p 00000000 00:00 0
38e3200000-38e3282000 r-xp 00000000 09:01 418108 /lib64/libm-2.5.so
38e3282000-38e3481000 ---p 00082000 09:01 418108 /lib64/libm-2.5.so
38e3481000-38e3482000 r--p 00081000 09:01 418108 /lib64/libm-2.5.so
38e3482000-38e3483000 rw-p 00082000 09:01 418108 /lib64/libm-2.5.so
38e3600000-38e3615000 r-xp 00000000 09:01 418110 /lib64/libselinux.so.1
38e3615000-38e3815000 ---p 00015000 09:01 418110 /lib64/libselinux.so.1
38e3815000-38e3817000 rw-p 00015000 09:01 418110 /lib64/libselinux.so.1
38e3817000-38e3818000 rw-p 00000000 00:00 0
38e3a00000-38e3a14000 r-xp 00000000 09:01 417838 /lib64/libz.so.1.2.3
38e3a14000-38e3c13000 ---p 00014000 09:01 417838 /lib64/libz.so.1.2.3
38e3c13000-38e3c14000 rw-p 00013000 09:01 417838 /lib64/libz.so.1.2.3
38e4200000-38e4209000 r-xp 00000000 09:01 418111 /lib64/libcrypt-2.5.so
38e4209000-38e4408000 ---p 00009000 09:01 418111 /lib64/libcrypt-2.5.so
38e4408000-38e4409000 r--p 00008000 09:01 418111 /lib64/libcrypt-2.5.so
38e4409000-38e440a000 rw-p 00009000 09:01 418111 /lib64/libcrypt-2.5.so
38e440a000-38e4438000 rw-p 00000000 00:00 0
38e4600000-38e460d000 r-xp 00000000 09:01 418113 /lib64/libgcc_s-4.1.2-20080825.so.1
38e460d000-38e480d000 ---p 0000d000 09:01 418113 /lib64/libgcc_s-4.1.2-20080825.so.1
38e480d000-38e480e000 rw-p 0000d000 09:01 418113 /lib64/libgcc_s-4.1.2-20080825.so.1
38e4a00000-38e4a15000 r-xp 00000000 09:01 418006 /lib64/libnsl-2.5.so
38e4a15000-38e4c14000 ---p 00015000 09:01 418006 /lib64/libnsl-2.5.so
38e4c14000-38e4c15000 r--p 00014000 09:01 418006 /lib64/libnsl-2.5.so
38e4c15000-38e4c16000 rw-p 00015000 09:01 418006 /lib64/libnsl-2.5.so
38e4c16000-38e4c18000 rw-p 00000000 00:00 0
38e4e00000-38e4f2d000 r-xp 00000000 09:01 418112 /lib64/libcrypto.so.0.9.8e
38e4f2d000-38e512c000 ---p 0012d000 09:01 418112 /lib64/libcrypto.so.0.9.8e
38e512c000-38e514d000 rw-p 0012c000 09:01 418112 /lib64/libcrypto.so.0.9.8e
38e514d000-38e5151000 rw-p 00000000 00:00 0
38e5600000-38e562c000 r-xp 00000000 09:01 125103 /usr/lib64/libgssapi_krb5.so.2.2
38e562c000-38e582c000 ---p 0002c000 09:01 125103 /usr/lib64/libgssapi_krb5.so.2.2
38e582c000-38e582e000 rw-p 0002c000 09:01 125103 /usr/lib64/libgssapi_krb5.so.2.2
38e5a00000-38e5a11000 r-xp 00000000 09:01 417846 /lib64/libresolv-2.5.so
38e5a11000-38e5c11000 ---p 00011000 09:01 417846 /lib64/libresolv-2.5.so
38e5c11000-38e5c12000 r--p 00011000 09:01 417846 /lib64/libresolv-2.5.so
38e5c12000-38e5c13000 rw-p 00012000 09:01 417846 /lib64/libresolv-2.5.so
38e5c13000-38e5c15000 rw-p 00000000 00:00 0
38e5e00000-38e5e02000 r-xp 00000000 09:01 418116 /lib64/libcom_err.so.2.1
38e5e02000-38e6001000 ---p 00002000 09:01 418116 /lib64/libcom_err.so.2.1
38e6001000-38e6002000 rw-p 00001000 09:01 418116 /lib64/libcom_err.so.2.1
38e6200000-38e6292000 r-xp 00000000 09:01 125191 /usr/lib64/libkrb5.so.3.3
38e6292000-38e6491000 ---p 00092000 09:01 125191 /usr/lib64/libkrb5.so.3.3
38e6491000-38e6495000 rw-p 00091000 09:01 125191 /usr/lib64/libkrb5.so.3.3
38e6600000-38e6608000 r-xp 00000000 09:01 125251 /usr/lib64/libkrb5support.so.0.1
38e6608000-38e6807000 ---p 00008000 09:01 125251 /usr/lib64/libkrb5support.so.0.1
38e6807000-38e6808000 rw-p 00007000 09:01 125251 /usr/lib64/libkrb5support.so.0.1
38e6a00000-38e6a02000 r-xp 00000000 09:01 418121 /lib64/libkeyutils-1.2.so
38e6a02000-38e6c01000 ---p 00002000 09:01 418121 /lib64/libkeyutils-1.2.so
38e6c01000-38e6c02000 rw-p 00001000 09:01 418121 /lib64/libkeyutils-1.2.so
38e6e00000-38e6e24000 r-xp 00000000 09:01 125174 /usr/lib64/libk5crypto.so.3.1
38e6e24000-38e7023000 ---p 00024000 09:01 125174 /usr/lib64/libk5crypto.so.3.1
38e7023000-38e7025000 rw-p 00023000 09:01 125174 /usr/lib64/libk5crypto.so.3.1
38e7200000-38e7246000 r-xp 00000000 09:01 418122 /lib64/libssl.so.0.9.8e
38e7246000-38e7446000 ---p 00046000 09:01 418122 /lib64/libssl.so.0.9.8e
38e7446000-38e744c000 rw-p 00046000 09:01 418122 /lib64/libssl.so.0.9.8e
3bdf800000-3bdf830000 r-xp 00000000 09:01 125065 /usr/lib64/libcurl.so.3.0.0
3bdf830000-3bdfa30000 ---p 00030000 09:01 125065 /usr/lib64/libcurl.so.3.0.0
3bdfa30000-3bdfa32000 rw-p 00030000 09:01 125065 /usr/lib64/libcurl.so.3.0.0
7fb64436c000-7fb6443ed000 rw-p 00000000 00:00 0
7fb6443ed000-7fb6a1fed000 rw-s 00000000 00:0f 519295928 /dev/shm/apc.shm.WVNr59 (deleted)
7fb6a1fed000-7fb6a1ff7000 r-xp 00000000 09:01 417797 /lib64/libnss_files-2.5.so
7fb6a1ff7000-7fb6a21f6000 ---p 0000a000 09:01 417797 /lib64/libnss_files-2.5.so
7fb6a21f6000-7fb6a21f7000 r--p 00009000 09:01 417797 /lib64/libnss_files-2.5.so
7fb6a21f7000-7fb6a21f8000 rw-p 0000a000 09:01 417797 /lib64/libnss_files-2.5.so
7fb6a21f8000-7fb6a222e000 r-xp 00000000 09:01 271691 /usr/lib64/extensions/no-debug-non-zts-20090626/redis.so
7fb6a222e000-7fb6a242d000 ---p 00036000 09:01 271691 /usr/lib64/extensions/no-debug-non-zts-20090626/redis.so
7fb6a242d000-7fb6a2430000 rw-p 00035000 09:01 271691 /usr/lib64/extensions/no-debug-non-zts-20090626/redis.so
7fb6a2430000-7fb6a243a000 r-xp 00000000 09:01 271692 /usr/lib64/extensions/no-debug-non-zts-20090626/phpiredis.so
7fb6a243a000-7fb6a263a000 ---p 0000a000 09:01 271692 /usr/lib64/extensions/no-debug-non-zts-20090626/phpiredis.so
7fb6a263a000-7fb6a263b000 rw-p 0000a000 09:01 271692 /usr/lib64/extensions/no-debug-non-zts-20090626/phpiredis.so
7fb6a263b000-7fb6a265b000 r-xp 00000000 09:01 271688 /usr/lib64/extensions/no-debug-non-zts-20090626/apc.so
7fb6a265b000-7fb6a285b000 ---p 00020000 09:01 271688 /usr/lib64/extensions/no-debug-non-zts-20090626/apc.so
7fb6a285b000-7fb6a285e000 rw-p 00020000 09:01 271688 /usr/lib64/extensions/no-debug-non-zts-20090626/apc.so
7fb6a285e000-7fb6a2867000 rw-p 00000000 00:00 0
7fb6a2867000-7fb6a286c000 r-xp 00000000 09:01 271689 /usr/lib64/extensions/no-debug-non-zts-20090626/xhprof.so
7fb6a286c000-7fb6a2a6c000 ---p 00005000 09:01 271689 /usr/lib64/extensions/no-debug-non-zts-20090626/xhprof.so
7fb6a2a6c000-7fb6a2a6d000 rw-p 00005000 09:01 271689 /usr/lib64/extensions/no-debug-non-zts-20090626/xhprof.so
7fb6a2a6d000-7fb6a2abc000 rw-p 00000000 00:00 0
7fb6a2afd000-7fb6a2b02000 rw-p 00000000 00:00 0
7fb6a2b02000-7fb6a2b18000 r-xp 00000000 09:01 418104 /lib64/libpthread-2.5.so
7fb6a2b18000-7fb6a2d17000 ---p 00016000 09:01 418104 /lib64/libpthread-2.5.so
7fb6a2d17000-7fb6a2d18000 r--p 00015000 09:01 418104 /lib64/libpthread-2.5.so
7fb6a2d18000-7fb6a2d19000 rw-p 00016000 09:01 418104 /lib64/libpthread-2.5.so
7fb6a2d19000-7fb6a2d1e000 rw-p 00000000 00:00 0
7fb6a2d1e000-7fb6a2d67000 r-xp 00000000 09:01 199252 /usr/local/mysql/lib/mysql/libmysqlclient.so.16.0.0
7fb6a2d67000-7fb6a2f66000 ---p 00049000 09:01 199252 /usr/local/mysql/lib/mysql/libmysqlclient.so.16.0.0
7fb6a2f66000-7fb6a2f94000 rw-p 00048000 09:01 199252 /usr/local/mysql/lib/mysql/libmysqlclient.so.16.0.0
7fb6a2f94000-7fb6a2f99000 rw-p 00000000 00:00 0
7fb6a2fa2000-7fb6a2fa4000 rw-p 00000000 00:00 0
7fff5bc9c000-7fff5bcbd000 rw-p 00000000 00:00 0 [stack]
7fff5bdff000-7fff5be00000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r--p 00000000 00:00 0 [vsyscall]
/bin/sh: line 1: 8478 Aborted php ./phpiredis.php

Thanks

Hi,
thanks for the bug report. Can you help me reproduce the issue? At the moment I tried this code and it is not failing, so some code using phpiredis before that call may be affecting it.

$client = new Predis\Client($single_server, array( 'connections' => array('tcp' => 'Predis\Network\PhpiredisConnection')));
$client->hmset(1,"truc",2, "chose", 4, 'haaaaa', 1); 
nrk commented

The bug described in this issue was most likely the same reported here, since it has been fixed recently I'm closing this one.