@@ -1143,6 +1143,7 @@ static void LStat(const FunctionCallbackInfo<Value>& args) {
1143
1143
bool use_bigint = args[1 ]->IsTrue ();
1144
1144
if (!args[2 ]->IsUndefined ()) { // lstat(path, use_bigint, req)
1145
1145
FSReqBase* req_wrap_async = GetReqWrap (args, 2 , use_bigint);
1146
+ CHECK_NOT_NULL (req_wrap_async);
1146
1147
FS_ASYNC_TRACE_BEGIN1 (
1147
1148
UV_FS_LSTAT, req_wrap_async, " path" , TRACE_STR_COPY (*path))
1148
1149
AsyncCall (env, req_wrap_async, args, " lstat" , UTF8, AfterStat,
@@ -1185,6 +1186,7 @@ static void FStat(const FunctionCallbackInfo<Value>& args) {
1185
1186
bool use_bigint = args[1 ]->IsTrue ();
1186
1187
if (!args[2 ]->IsUndefined ()) { // fstat(fd, use_bigint, req)
1187
1188
FSReqBase* req_wrap_async = GetReqWrap (args, 2 , use_bigint);
1189
+ CHECK_NOT_NULL (req_wrap_async);
1188
1190
FS_ASYNC_TRACE_BEGIN0 (UV_FS_FSTAT, req_wrap_async)
1189
1191
AsyncCall (env, req_wrap_async, args, " fstat" , UTF8, AfterStat,
1190
1192
uv_fs_fstat, fd);
@@ -1286,6 +1288,7 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {
1286
1288
1287
1289
if (argc > 3 ) { // symlink(target, path, flags, req)
1288
1290
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
1291
+ CHECK_NOT_NULL (req_wrap_async);
1289
1292
FS_ASYNC_TRACE_BEGIN2 (UV_FS_SYMLINK,
1290
1293
req_wrap_async,
1291
1294
" target" ,
@@ -1324,6 +1327,7 @@ static void Link(const FunctionCallbackInfo<Value>& args) {
1324
1327
1325
1328
if (argc > 2 ) { // link(src, dest, req)
1326
1329
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1330
+ CHECK_NOT_NULL (req_wrap_async);
1327
1331
// To avoid bypass the link target should be allowed to read and write
1328
1332
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
1329
1333
env,
@@ -1382,6 +1386,7 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) {
1382
1386
1383
1387
if (argc > 2 ) { // readlink(path, encoding, req)
1384
1388
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1389
+ CHECK_NOT_NULL (req_wrap_async);
1385
1390
FS_ASYNC_TRACE_BEGIN1 (
1386
1391
UV_FS_READLINK, req_wrap_async, " path" , TRACE_STR_COPY (*path))
1387
1392
AsyncCall (env, req_wrap_async, args, " readlink" , encoding, AfterStringPtr,
@@ -1422,6 +1427,7 @@ static void Rename(const FunctionCallbackInfo<Value>& args) {
1422
1427
1423
1428
if (argc > 2 ) { // rename(old_path, new_path, req)
1424
1429
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1430
+ CHECK_NOT_NULL (req_wrap_async);
1425
1431
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
1426
1432
env,
1427
1433
req_wrap_async,
@@ -1479,6 +1485,7 @@ static void FTruncate(const FunctionCallbackInfo<Value>& args) {
1479
1485
1480
1486
if (argc > 2 ) { // ftruncate(fd, len, req)
1481
1487
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1488
+ CHECK_NOT_NULL (req_wrap_async);
1482
1489
FS_ASYNC_TRACE_BEGIN0 (UV_FS_FTRUNCATE, req_wrap_async)
1483
1490
AsyncCall (env, req_wrap_async, args, " ftruncate" , UTF8, AfterNoArgs,
1484
1491
uv_fs_ftruncate, fd, len);
@@ -1588,6 +1595,7 @@ static void RMDir(const FunctionCallbackInfo<Value>& args) {
1588
1595
1589
1596
if (argc > 1 ) {
1590
1597
FSReqBase* req_wrap_async = GetReqWrap (args, 1 ); // rmdir(path, req)
1598
+ CHECK_NOT_NULL (req_wrap_async);
1591
1599
FS_ASYNC_TRACE_BEGIN1 (
1592
1600
UV_FS_RMDIR, req_wrap_async, " path" , TRACE_STR_COPY (*path))
1593
1601
AsyncCall (env, req_wrap_async, args, " rmdir" , UTF8, AfterNoArgs,
@@ -1885,6 +1893,7 @@ static void MKDir(const FunctionCallbackInfo<Value>& args) {
1885
1893
1886
1894
if (argc > 3 ) { // mkdir(path, mode, recursive, req)
1887
1895
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
1896
+ CHECK_NOT_NULL (req_wrap_async);
1888
1897
FS_ASYNC_TRACE_BEGIN1 (
1889
1898
UV_FS_UNLINK, req_wrap_async, " path" , TRACE_STR_COPY (*path))
1890
1899
AsyncCall (env, req_wrap_async, args, " mkdir" , UTF8,
@@ -1931,6 +1940,7 @@ static void RealPath(const FunctionCallbackInfo<Value>& args) {
1931
1940
1932
1941
if (argc > 2 ) { // realpath(path, encoding, req)
1933
1942
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1943
+ CHECK_NOT_NULL (req_wrap_async);
1934
1944
FS_ASYNC_TRACE_BEGIN1 (
1935
1945
UV_FS_REALPATH, req_wrap_async, " path" , TRACE_STR_COPY (*path))
1936
1946
AsyncCall (env, req_wrap_async, args, " realpath" , encoding, AfterStringPtr,
@@ -1992,6 +2002,7 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
1992
2002
1993
2003
if (argc > 3 ) { // readdir(path, encoding, withTypes, req)
1994
2004
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2005
+ CHECK_NOT_NULL (req_wrap_async);
1995
2006
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
1996
2007
env,
1997
2008
req_wrap_async,
@@ -2239,6 +2250,7 @@ static void CopyFile(const FunctionCallbackInfo<Value>& args) {
2239
2250
2240
2251
if (argc > 3 ) { // copyFile(src, dest, flags, req)
2241
2252
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2253
+ CHECK_NOT_NULL (req_wrap_async);
2242
2254
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
2243
2255
env,
2244
2256
req_wrap_async,
@@ -2374,6 +2386,7 @@ static void WriteBuffers(const FunctionCallbackInfo<Value>& args) {
2374
2386
2375
2387
if (argc > 3 ) { // writeBuffers(fd, chunks, pos, req)
2376
2388
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2389
+ CHECK_NOT_NULL (req_wrap_async);
2377
2390
FS_ASYNC_TRACE_BEGIN0 (UV_FS_WRITE, req_wrap_async)
2378
2391
AsyncCall (env,
2379
2392
req_wrap_async,
@@ -2758,6 +2771,7 @@ static void ReadBuffers(const FunctionCallbackInfo<Value>& args) {
2758
2771
2759
2772
if (argc > 3 ) { // readBuffers(fd, buffers, pos, req)
2760
2773
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2774
+ CHECK_NOT_NULL (req_wrap_async);
2761
2775
FS_ASYNC_TRACE_BEGIN0 (UV_FS_READ, req_wrap_async)
2762
2776
AsyncCall (env, req_wrap_async, args, " read" , UTF8, AfterInteger,
2763
2777
uv_fs_read, fd, *iovs, iovs.length (), pos);
@@ -2795,6 +2809,7 @@ static void Chmod(const FunctionCallbackInfo<Value>& args) {
2795
2809
2796
2810
if (argc > 2 ) { // chmod(path, mode, req)
2797
2811
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
2812
+ CHECK_NOT_NULL (req_wrap_async);
2798
2813
FS_ASYNC_TRACE_BEGIN1 (
2799
2814
UV_FS_CHMOD, req_wrap_async, " path" , TRACE_STR_COPY (*path))
2800
2815
AsyncCall (env, req_wrap_async, args, " chmod" , UTF8, AfterNoArgs,
@@ -2827,6 +2842,7 @@ static void FChmod(const FunctionCallbackInfo<Value>& args) {
2827
2842
2828
2843
if (argc > 2 ) { // fchmod(fd, mode, req)
2829
2844
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
2845
+ CHECK_NOT_NULL (req_wrap_async);
2830
2846
FS_ASYNC_TRACE_BEGIN0 (UV_FS_FCHMOD, req_wrap_async)
2831
2847
AsyncCall (env, req_wrap_async, args, " fchmod" , UTF8, AfterNoArgs,
2832
2848
uv_fs_fchmod, fd, mode);
@@ -2904,6 +2920,7 @@ static void FChown(const FunctionCallbackInfo<Value>& args) {
2904
2920
2905
2921
if (argc > 3 ) { // fchown(fd, uid, gid, req)
2906
2922
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2923
+ CHECK_NOT_NULL (req_wrap_async);
2907
2924
FS_ASYNC_TRACE_BEGIN0 (UV_FS_FCHOWN, req_wrap_async)
2908
2925
AsyncCall (env, req_wrap_async, args, " fchown" , UTF8, AfterNoArgs,
2909
2926
uv_fs_fchown, fd, uid, gid);
@@ -2934,6 +2951,7 @@ static void LChown(const FunctionCallbackInfo<Value>& args) {
2934
2951
2935
2952
if (argc > 3 ) { // lchown(path, uid, gid, req)
2936
2953
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2954
+ CHECK_NOT_NULL (req_wrap_async);
2937
2955
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
2938
2956
env,
2939
2957
req_wrap_async,
@@ -2976,6 +2994,7 @@ static void UTimes(const FunctionCallbackInfo<Value>& args) {
2976
2994
2977
2995
if (argc > 3 ) { // utimes(path, atime, mtime, req)
2978
2996
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2997
+ CHECK_NOT_NULL (req_wrap_async);
2979
2998
FS_ASYNC_TRACE_BEGIN1 (
2980
2999
UV_FS_UTIME, req_wrap_async, " path" , TRACE_STR_COPY (*path))
2981
3000
AsyncCall (env, req_wrap_async, args, " utime" , UTF8, AfterNoArgs,
@@ -3008,6 +3027,7 @@ static void FUTimes(const FunctionCallbackInfo<Value>& args) {
3008
3027
3009
3028
if (argc > 3 ) { // futimes(fd, atime, mtime, req)
3010
3029
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
3030
+ CHECK_NOT_NULL (req_wrap_async);
3011
3031
FS_ASYNC_TRACE_BEGIN0 (UV_FS_FUTIME, req_wrap_async)
3012
3032
AsyncCall (env, req_wrap_async, args, " futime" , UTF8, AfterNoArgs,
3013
3033
uv_fs_futime, fd, atime, mtime);
@@ -3040,6 +3060,7 @@ static void LUTimes(const FunctionCallbackInfo<Value>& args) {
3040
3060
3041
3061
if (argc > 3 ) { // lutimes(path, atime, mtime, req)
3042
3062
FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
3063
+ CHECK_NOT_NULL (req_wrap_async);
3043
3064
FS_ASYNC_TRACE_BEGIN1 (
3044
3065
UV_FS_LUTIME, req_wrap_async, " path" , TRACE_STR_COPY (*path))
3045
3066
AsyncCall (env, req_wrap_async, args, " lutime" , UTF8, AfterNoArgs,
@@ -3072,6 +3093,7 @@ static void Mkdtemp(const FunctionCallbackInfo<Value>& args) {
3072
3093
3073
3094
if (argc > 2 ) { // mkdtemp(tmpl, encoding, req)
3074
3095
FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
3096
+ CHECK_NOT_NULL (req_wrap_async);
3075
3097
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
3076
3098
env,
3077
3099
req_wrap_async,
0 commit comments