@@ -1149,6 +1149,7 @@ static void LStat(const FunctionCallbackInfo<Value>& args) {
1149
1149
bool use_bigint = args[1 ]->IsTrue ();
1150
1150
if (!args[2 ]->IsUndefined ()) { // lstat(path, use_bigint, req)
1151
1151
FSReqBase* req_wrap_async = GetReqWrap (args, 2 , use_bigint);
1152
+ CHECK_NOT_NULL (req_wrap_async);
1152
1153
FS_ASYNC_TRACE_BEGIN1 (
1153
1154
UV_FS_LSTAT, req_wrap_async, " path" , TRACE_STR_COPY (*path))
1154
1155
AsyncCall (env, req_wrap_async, args, " lstat" , UTF8, AfterStat,
@@ -1191,6 +1192,7 @@ static void FStat(const FunctionCallbackInfo<Value>& args) {
1191
1192
bool use_bigint = args[1 ]->IsTrue ();
1192
1193
if (!args[2 ]->IsUndefined ()) { // fstat(fd, use_bigint, req)
1193
1194
FSReqBase* req_wrap_async = GetReqWrap (args, 2 , use_bigint);
1195
+ CHECK_NOT_NULL (req_wrap_async);
1194
1196
FS_ASYNC_TRACE_BEGIN0 (UV_FS_FSTAT, req_wrap_async)
1195
1197
AsyncCall (env, req_wrap_async, args, " fstat" , UTF8, AfterStat,
1196
1198
uv_fs_fstat, fd);
@@ -1292,6 +1294,7 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {
1292
1294
1293
1295
if (argc > 3 ) { // symlink(target, path, flags, req)
1294
1296
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
1297
+ CHECK_NOT_NULL (req_wrap_async);
1295
1298
FS_ASYNC_TRACE_BEGIN2 (UV_FS_SYMLINK,
1296
1299
req_wrap_async,
1297
1300
" target" ,
@@ -1330,6 +1333,7 @@ static void Link(const FunctionCallbackInfo<Value>& args) {
1330
1333
1331
1334
if (argc > 2 ) { // link(src, dest, req)
1332
1335
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1336
+ CHECK_NOT_NULL (req_wrap_async);
1333
1337
// To avoid bypass the link target should be allowed to read and write
1334
1338
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
1335
1339
env,
@@ -1388,6 +1392,7 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) {
1388
1392
1389
1393
if (argc > 2 ) { // readlink(path, encoding, req)
1390
1394
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1395
+ CHECK_NOT_NULL (req_wrap_async);
1391
1396
FS_ASYNC_TRACE_BEGIN1 (
1392
1397
UV_FS_READLINK, req_wrap_async, " path" , TRACE_STR_COPY (*path))
1393
1398
AsyncCall (env, req_wrap_async, args, " readlink" , encoding, AfterStringPtr,
@@ -1428,6 +1433,7 @@ static void Rename(const FunctionCallbackInfo<Value>& args) {
1428
1433
1429
1434
if (argc > 2 ) { // rename(old_path, new_path, req)
1430
1435
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1436
+ CHECK_NOT_NULL (req_wrap_async);
1431
1437
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
1432
1438
env,
1433
1439
req_wrap_async,
@@ -1485,6 +1491,7 @@ static void FTruncate(const FunctionCallbackInfo<Value>& args) {
1485
1491
1486
1492
if (argc > 2 ) { // ftruncate(fd, len, req)
1487
1493
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1494
+ CHECK_NOT_NULL (req_wrap_async);
1488
1495
FS_ASYNC_TRACE_BEGIN0 (UV_FS_FTRUNCATE, req_wrap_async)
1489
1496
AsyncCall (env, req_wrap_async, args, " ftruncate" , UTF8, AfterNoArgs,
1490
1497
uv_fs_ftruncate, fd, len);
@@ -1594,6 +1601,7 @@ static void RMDir(const FunctionCallbackInfo<Value>& args) {
1594
1601
1595
1602
if (argc > 1 ) {
1596
1603
FSReqBase* req_wrap_async = GetReqWrap (args, 1 ); // rmdir(path, req)
1604
+ CHECK_NOT_NULL (req_wrap_async);
1597
1605
FS_ASYNC_TRACE_BEGIN1 (
1598
1606
UV_FS_RMDIR, req_wrap_async, " path" , TRACE_STR_COPY (*path))
1599
1607
AsyncCall (env, req_wrap_async, args, " rmdir" , UTF8, AfterNoArgs,
@@ -1891,6 +1899,7 @@ static void MKDir(const FunctionCallbackInfo<Value>& args) {
1891
1899
1892
1900
if (argc > 3 ) { // mkdir(path, mode, recursive, req)
1893
1901
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
1902
+ CHECK_NOT_NULL (req_wrap_async);
1894
1903
FS_ASYNC_TRACE_BEGIN1 (
1895
1904
UV_FS_UNLINK, req_wrap_async, " path" , TRACE_STR_COPY (*path))
1896
1905
AsyncCall (env, req_wrap_async, args, " mkdir" , UTF8,
@@ -1937,6 +1946,7 @@ static void RealPath(const FunctionCallbackInfo<Value>& args) {
1937
1946
1938
1947
if (argc > 2 ) { // realpath(path, encoding, req)
1939
1948
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1949
+ CHECK_NOT_NULL (req_wrap_async);
1940
1950
FS_ASYNC_TRACE_BEGIN1 (
1941
1951
UV_FS_REALPATH, req_wrap_async, " path" , TRACE_STR_COPY (*path))
1942
1952
AsyncCall (env, req_wrap_async, args, " realpath" , encoding, AfterStringPtr,
@@ -1998,6 +2008,7 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
1998
2008
1999
2009
if (argc > 3 ) { // readdir(path, encoding, withTypes, req)
2000
2010
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2011
+ CHECK_NOT_NULL (req_wrap_async);
2001
2012
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
2002
2013
env,
2003
2014
req_wrap_async,
@@ -2245,6 +2256,7 @@ static void CopyFile(const FunctionCallbackInfo<Value>& args) {
2245
2256
2246
2257
if (argc > 3 ) { // copyFile(src, dest, flags, req)
2247
2258
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2259
+ CHECK_NOT_NULL (req_wrap_async);
2248
2260
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
2249
2261
env,
2250
2262
req_wrap_async,
@@ -2380,6 +2392,7 @@ static void WriteBuffers(const FunctionCallbackInfo<Value>& args) {
2380
2392
2381
2393
if (argc > 3 ) { // writeBuffers(fd, chunks, pos, req)
2382
2394
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2395
+ CHECK_NOT_NULL (req_wrap_async);
2383
2396
FS_ASYNC_TRACE_BEGIN0 (UV_FS_WRITE, req_wrap_async)
2384
2397
AsyncCall (env,
2385
2398
req_wrap_async,
@@ -2764,6 +2777,7 @@ static void ReadBuffers(const FunctionCallbackInfo<Value>& args) {
2764
2777
2765
2778
if (argc > 3 ) { // readBuffers(fd, buffers, pos, req)
2766
2779
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2780
+ CHECK_NOT_NULL (req_wrap_async);
2767
2781
FS_ASYNC_TRACE_BEGIN0 (UV_FS_READ, req_wrap_async)
2768
2782
AsyncCall (env, req_wrap_async, args, " read" , UTF8, AfterInteger,
2769
2783
uv_fs_read, fd, *iovs, iovs.length (), pos);
@@ -2801,6 +2815,7 @@ static void Chmod(const FunctionCallbackInfo<Value>& args) {
2801
2815
2802
2816
if (argc > 2 ) { // chmod(path, mode, req)
2803
2817
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
2818
+ CHECK_NOT_NULL (req_wrap_async);
2804
2819
FS_ASYNC_TRACE_BEGIN1 (
2805
2820
UV_FS_CHMOD, req_wrap_async, " path" , TRACE_STR_COPY (*path))
2806
2821
AsyncCall (env, req_wrap_async, args, " chmod" , UTF8, AfterNoArgs,
@@ -2833,6 +2848,7 @@ static void FChmod(const FunctionCallbackInfo<Value>& args) {
2833
2848
2834
2849
if (argc > 2 ) { // fchmod(fd, mode, req)
2835
2850
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
2851
+ CHECK_NOT_NULL (req_wrap_async);
2836
2852
FS_ASYNC_TRACE_BEGIN0 (UV_FS_FCHMOD, req_wrap_async)
2837
2853
AsyncCall (env, req_wrap_async, args, " fchmod" , UTF8, AfterNoArgs,
2838
2854
uv_fs_fchmod, fd, mode);
@@ -2910,6 +2926,7 @@ static void FChown(const FunctionCallbackInfo<Value>& args) {
2910
2926
2911
2927
if (argc > 3 ) { // fchown(fd, uid, gid, req)
2912
2928
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2929
+ CHECK_NOT_NULL (req_wrap_async);
2913
2930
FS_ASYNC_TRACE_BEGIN0 (UV_FS_FCHOWN, req_wrap_async)
2914
2931
AsyncCall (env, req_wrap_async, args, " fchown" , UTF8, AfterNoArgs,
2915
2932
uv_fs_fchown, fd, uid, gid);
@@ -2940,6 +2957,7 @@ static void LChown(const FunctionCallbackInfo<Value>& args) {
2940
2957
2941
2958
if (argc > 3 ) { // lchown(path, uid, gid, req)
2942
2959
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2960
+ CHECK_NOT_NULL (req_wrap_async);
2943
2961
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
2944
2962
env,
2945
2963
req_wrap_async,
@@ -2982,6 +3000,7 @@ static void UTimes(const FunctionCallbackInfo<Value>& args) {
2982
3000
2983
3001
if (argc > 3 ) { // utimes(path, atime, mtime, req)
2984
3002
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
3003
+ CHECK_NOT_NULL (req_wrap_async);
2985
3004
FS_ASYNC_TRACE_BEGIN1 (
2986
3005
UV_FS_UTIME, req_wrap_async, " path" , TRACE_STR_COPY (*path))
2987
3006
AsyncCall (env, req_wrap_async, args, " utime" , UTF8, AfterNoArgs,
@@ -3014,6 +3033,7 @@ static void FUTimes(const FunctionCallbackInfo<Value>& args) {
3014
3033
3015
3034
if (argc > 3 ) { // futimes(fd, atime, mtime, req)
3016
3035
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
3036
+ CHECK_NOT_NULL (req_wrap_async);
3017
3037
FS_ASYNC_TRACE_BEGIN0 (UV_FS_FUTIME, req_wrap_async)
3018
3038
AsyncCall (env, req_wrap_async, args, " futime" , UTF8, AfterNoArgs,
3019
3039
uv_fs_futime, fd, atime, mtime);
@@ -3046,6 +3066,7 @@ static void LUTimes(const FunctionCallbackInfo<Value>& args) {
3046
3066
3047
3067
if (argc > 3 ) { // lutimes(path, atime, mtime, req)
3048
3068
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
3069
+ CHECK_NOT_NULL (req_wrap_async);
3049
3070
FS_ASYNC_TRACE_BEGIN1 (
3050
3071
UV_FS_LUTIME, req_wrap_async, " path" , TRACE_STR_COPY (*path))
3051
3072
AsyncCall (env, req_wrap_async, args, " lutime" , UTF8, AfterNoArgs,
@@ -3078,6 +3099,7 @@ static void Mkdtemp(const FunctionCallbackInfo<Value>& args) {
3078
3099
3079
3100
if (argc > 2 ) { // mkdtemp(tmpl, encoding, req)
3080
3101
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
3102
+ CHECK_NOT_NULL (req_wrap_async);
3081
3103
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
3082
3104
env,
3083
3105
req_wrap_async,
0 commit comments