amphp / ext-uv

Other
188 stars 28 forks source link

uv_fs_readlink causes segfault #69

Closed ghost closed 5 years ago

ghost commented 5 years ago

I'm getting on both windows and debian a segmentation fault when using uv_fs_readlink.

Example:

$uv = uv_loop_new();

uv_fs_readlink($uv, __FILE__, function () {
    var_dump(func_get_args());
});

uv_run($uv);

Coredump backtrace:

(gdb) bt
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
#1  0x00007f53ae11e8c1 in php_uv_fs_cb (req=0x7f53ae884040) at /tmp/pear/temp/uv/php_uv.c:1876
#2  0x00007f53adef1030 in ?? () from /usr/lib/x86_64-linux-gnu/libuv.so.1
#3  0x00007f53adef2f83 in ?? () from /usr/lib/x86_64-linux-gnu/libuv.so.1
#4  0x00007f53adef3066 in ?? () from /usr/lib/x86_64-linux-gnu/libuv.so.1
#5  0x00007f53adf01ee8 in ?? () from /usr/lib/x86_64-linux-gnu/libuv.so.1
#6  0x00007f53adef3924 in uv_run () from /usr/lib/x86_64-linux-gnu/libuv.so.1
#7  0x00007f53ae119f35 in zif_uv_run (execute_data=<optimized out>, return_value=<optimized out>)
    at /tmp/pear/temp/uv/php_uv.c:3494
#8  0x00007f53ae348445 in xdebug_execute_internal (current_execute_data=0x7f53ae81d0e0, return_value=0x7ffefff18808)
    at ./build-7.3/xdebug.c:2050
#9  0x0000564474c0dfb7 in ?? ()
#10 0x0000564474e45c9b in execute_ex ()
#11 0x00007f53ae347b21 in xdebug_execute_ex (execute_data=0x7f53ae81d030) at ./build-7.3/xdebug.c:1928
#12 0x0000564474e4dd5a in zend_execute ()
#13 0x0000564474dbedd3 in zend_execute_scripts ()
#14 0x0000564474d5d598 in php_execute_script ()
#15 0x0000564474e501df in ?? ()
#16 0x0000564474c16b02 in ?? ()
#17 0x00007f53b17f42e1 in __libc_start_main (main=0x564474c16690, argc=2, argv=0x7ffefff1c2f8, init=<optimized out>,
    fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffefff1c2e8) at ../csu/libc-start.c:291
#18 0x0000564474c16c1a in _start ()

On Windows I'm using the PECL generated DLL for PHP 7.2.17 ZTS MSVC15 x64. On Debian I've let PECL compile it for 7.3.3 NTS (with libuv 1.9.1 from the repositories).

bwoebi commented 5 years ago

Thanks, fixed via https://github.com/bwoebi/php-uv/commit/63fa7f1609f6989aa5abf938c465643dd8a120bb