mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-26 20:14:47 +01:00
Fix segfault on uv_fs_readlink() where target is not a link
This commit is contained in:
parent
c06742a558
commit
63fa7f1609
@ -10,11 +10,11 @@
|
||||
<email>bobwei9@hotmail.com</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2019-04-28</date>
|
||||
<date>2019-05-01</date>
|
||||
<time>13:00:00</time>
|
||||
<version>
|
||||
<release>0.2.3</release>
|
||||
<api>0.2.3</api>
|
||||
<release>0.2.4</release>
|
||||
<api>0.2.4</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>beta</release>
|
||||
@ -23,7 +23,6 @@
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<notes>
|
||||
- Fix Windows build
|
||||
- Fix PHP 7.4 build
|
||||
</notes>
|
||||
<contents>
|
||||
<dir name="/">
|
||||
|
6
php_uv.c
6
php_uv.c
@ -1873,7 +1873,11 @@ static void php_uv_fs_cb(uv_fs_t* req)
|
||||
case UV_FS_READLINK:
|
||||
argc = 2;
|
||||
ZVAL_BOOL(¶ms[0], uv->uv.fs.result == 0);
|
||||
ZVAL_STRING(¶ms[1], req->ptr);
|
||||
if (uv->uv.fs.result == 0) {
|
||||
ZVAL_STRING(¶ms[1], req->ptr);
|
||||
} else {
|
||||
ZVAL_NULL(¶ms[1]);
|
||||
}
|
||||
break;
|
||||
|
||||
case UV_FS_READ:
|
||||
|
2
php_uv.h
2
php_uv.h
@ -3,7 +3,7 @@
|
||||
#define PHP_UV_H
|
||||
|
||||
#define PHP_UV_EXTNAME "uv"
|
||||
#define PHP_UV_VERSION "0.2.3"
|
||||
#define PHP_UV_VERSION "0.2.4"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
|
22
tests/320-fs-readlink.phpt
Normal file
22
tests/320-fs-readlink.phpt
Normal file
@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
uv_fs_readlink() segfaults if file not a link
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uv = uv_loop_new();
|
||||
|
||||
uv_fs_readlink($uv, __FILE__, function () {
|
||||
var_dump(func_get_args());
|
||||
});
|
||||
|
||||
uv_run($uv);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(2) {
|
||||
[0]=>
|
||||
bool(false)
|
||||
[1]=>
|
||||
NULL
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user