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>
|
<email>bobwei9@hotmail.com</email>
|
||||||
<active>yes</active>
|
<active>yes</active>
|
||||||
</lead>
|
</lead>
|
||||||
<date>2019-04-28</date>
|
<date>2019-05-01</date>
|
||||||
<time>13:00:00</time>
|
<time>13:00:00</time>
|
||||||
<version>
|
<version>
|
||||||
<release>0.2.3</release>
|
<release>0.2.4</release>
|
||||||
<api>0.2.3</api>
|
<api>0.2.4</api>
|
||||||
</version>
|
</version>
|
||||||
<stability>
|
<stability>
|
||||||
<release>beta</release>
|
<release>beta</release>
|
||||||
@ -23,7 +23,6 @@
|
|||||||
<license uri="http://www.php.net/license">PHP License</license>
|
<license uri="http://www.php.net/license">PHP License</license>
|
||||||
<notes>
|
<notes>
|
||||||
- Fix Windows build
|
- Fix Windows build
|
||||||
- Fix PHP 7.4 build
|
|
||||||
</notes>
|
</notes>
|
||||||
<contents>
|
<contents>
|
||||||
<dir name="/">
|
<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:
|
case UV_FS_READLINK:
|
||||||
argc = 2;
|
argc = 2;
|
||||||
ZVAL_BOOL(¶ms[0], uv->uv.fs.result == 0);
|
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;
|
break;
|
||||||
|
|
||||||
case UV_FS_READ:
|
case UV_FS_READ:
|
||||||
|
2
php_uv.h
2
php_uv.h
@ -3,7 +3,7 @@
|
|||||||
#define PHP_UV_H
|
#define PHP_UV_H
|
||||||
|
|
||||||
#define PHP_UV_EXTNAME "uv"
|
#define PHP_UV_EXTNAME "uv"
|
||||||
#define PHP_UV_VERSION "0.2.3"
|
#define PHP_UV_VERSION "0.2.4"
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "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