@@ -1149,6 +1149,7 @@ static void LStat(const FunctionCallbackInfo<Value>& args) {
11491149bool use_bigint = args[1 ]->IsTrue ();
11501150if (!args[2 ]->IsUndefined ()) { // lstat(path, use_bigint, req)
11511151 FSReqBase* req_wrap_async = GetReqWrap (args, 2 , use_bigint);
1152+ CHECK_NOT_NULL (req_wrap_async);
11521153FS_ASYNC_TRACE_BEGIN1 (
11531154UV_FS_LSTAT , req_wrap_async, " path" , TRACE_STR_COPY (*path))
11541155AsyncCall (env, req_wrap_async, args, " lstat" , UTF8 , AfterStat,
@@ -1191,6 +1192,7 @@ static void FStat(const FunctionCallbackInfo<Value>& args) {
11911192bool use_bigint = args[1 ]->IsTrue ();
11921193if (!args[2 ]->IsUndefined ()) { // fstat(fd, use_bigint, req)
11931194 FSReqBase* req_wrap_async = GetReqWrap (args, 2 , use_bigint);
1195+ CHECK_NOT_NULL (req_wrap_async);
11941196FS_ASYNC_TRACE_BEGIN0 (UV_FS_FSTAT , req_wrap_async)
11951197AsyncCall (env, req_wrap_async, args, " fstat" , UTF8 , AfterStat,
11961198 uv_fs_fstat, fd);
@@ -1292,6 +1294,7 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {
12921294
12931295if (argc > 3 ) { // symlink(target, path, flags, req)
12941296 FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
1297+ CHECK_NOT_NULL (req_wrap_async);
12951298FS_ASYNC_TRACE_BEGIN2 (UV_FS_SYMLINK ,
12961299 req_wrap_async,
12971300" target" ,
@@ -1330,6 +1333,7 @@ static void Link(const FunctionCallbackInfo<Value>& args) {
13301333
13311334if (argc > 2 ) { // link(src, dest, req)
13321335 FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1336+ CHECK_NOT_NULL (req_wrap_async);
13331337// To avoid bypass the link target should be allowed to read and write
13341338ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
13351339 env,
@@ -1388,6 +1392,7 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) {
13881392
13891393if (argc > 2 ) { // readlink(path, encoding, req)
13901394 FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1395+ CHECK_NOT_NULL (req_wrap_async);
13911396FS_ASYNC_TRACE_BEGIN1 (
13921397UV_FS_READLINK , req_wrap_async, " path" , TRACE_STR_COPY (*path))
13931398AsyncCall (env, req_wrap_async, args, " readlink" , encoding, AfterStringPtr,
@@ -1428,6 +1433,7 @@ static void Rename(const FunctionCallbackInfo<Value>& args) {
14281433
14291434if (argc > 2 ) { // rename(old_path, new_path, req)
14301435 FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1436+ CHECK_NOT_NULL (req_wrap_async);
14311437ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
14321438 env,
14331439 req_wrap_async,
@@ -1485,6 +1491,7 @@ static void FTruncate(const FunctionCallbackInfo<Value>& args) {
14851491
14861492if (argc > 2 ) { // ftruncate(fd, len, req)
14871493 FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1494+ CHECK_NOT_NULL (req_wrap_async);
14881495FS_ASYNC_TRACE_BEGIN0 (UV_FS_FTRUNCATE , req_wrap_async)
14891496AsyncCall (env, req_wrap_async, args, " ftruncate" , UTF8 , AfterNoArgs,
14901497 uv_fs_ftruncate, fd, len);
@@ -1594,6 +1601,7 @@ static void RMDir(const FunctionCallbackInfo<Value>& args) {
15941601
15951602if (argc > 1 ) {
15961603 FSReqBase* req_wrap_async = GetReqWrap (args, 1 ); // rmdir(path, req)
1604+ CHECK_NOT_NULL (req_wrap_async);
15971605FS_ASYNC_TRACE_BEGIN1 (
15981606UV_FS_RMDIR , req_wrap_async, " path" , TRACE_STR_COPY (*path))
15991607AsyncCall (env, req_wrap_async, args, " rmdir" , UTF8 , AfterNoArgs,
@@ -1891,6 +1899,7 @@ static void MKDir(const FunctionCallbackInfo<Value>& args) {
18911899
18921900if (argc > 3 ) { // mkdir(path, mode, recursive, req)
18931901 FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
1902+ CHECK_NOT_NULL (req_wrap_async);
18941903FS_ASYNC_TRACE_BEGIN1 (
18951904UV_FS_UNLINK , req_wrap_async, " path" , TRACE_STR_COPY (*path))
18961905AsyncCall (env, req_wrap_async, args, " mkdir" , UTF8 ,
@@ -1937,6 +1946,7 @@ static void RealPath(const FunctionCallbackInfo<Value>& args) {
19371946
19381947if (argc > 2 ) { // realpath(path, encoding, req)
19391948 FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
1949+ CHECK_NOT_NULL (req_wrap_async);
19401950FS_ASYNC_TRACE_BEGIN1 (
19411951UV_FS_REALPATH , req_wrap_async, " path" , TRACE_STR_COPY (*path))
19421952AsyncCall (env, req_wrap_async, args, " realpath" , encoding, AfterStringPtr,
@@ -1998,6 +2008,7 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {
19982008
19992009if (argc > 3 ) { // readdir(path, encoding, withTypes, req)
20002010 FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2011+ CHECK_NOT_NULL (req_wrap_async);
20012012ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
20022013 env,
20032014 req_wrap_async,
@@ -2245,6 +2256,7 @@ static void CopyFile(const FunctionCallbackInfo<Value>& args) {
22452256
22462257if (argc > 3 ) { // copyFile(src, dest, flags, req)
22472258 FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2259+ CHECK_NOT_NULL (req_wrap_async);
22482260ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
22492261 env,
22502262 req_wrap_async,
@@ -2380,6 +2392,7 @@ static void WriteBuffers(const FunctionCallbackInfo<Value>& args) {
23802392
23812393if (argc > 3 ) { // writeBuffers(fd, chunks, pos, req)
23822394 FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2395+ CHECK_NOT_NULL (req_wrap_async);
23832396FS_ASYNC_TRACE_BEGIN0 (UV_FS_WRITE , req_wrap_async)
23842397AsyncCall (env,
23852398 req_wrap_async,
@@ -2764,6 +2777,7 @@ static void ReadBuffers(const FunctionCallbackInfo<Value>& args) {
27642777
27652778if (argc > 3 ) { // readBuffers(fd, buffers, pos, req)
27662779 FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2780+ CHECK_NOT_NULL (req_wrap_async);
27672781FS_ASYNC_TRACE_BEGIN0 (UV_FS_READ , req_wrap_async)
27682782AsyncCall (env, req_wrap_async, args, " read" , UTF8 , AfterInteger,
27692783 uv_fs_read, fd, *iovs, iovs.length (), pos);
@@ -2801,6 +2815,7 @@ static void Chmod(const FunctionCallbackInfo<Value>& args) {
28012815
28022816if (argc > 2 ) { // chmod(path, mode, req)
28032817 FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
2818+ CHECK_NOT_NULL (req_wrap_async);
28042819FS_ASYNC_TRACE_BEGIN1 (
28052820UV_FS_CHMOD , req_wrap_async, " path" , TRACE_STR_COPY (*path))
28062821AsyncCall (env, req_wrap_async, args, " chmod" , UTF8 , AfterNoArgs,
@@ -2833,6 +2848,7 @@ static void FChmod(const FunctionCallbackInfo<Value>& args) {
28332848
28342849if (argc > 2 ) { // fchmod(fd, mode, req)
28352850 FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
2851+ CHECK_NOT_NULL (req_wrap_async);
28362852FS_ASYNC_TRACE_BEGIN0 (UV_FS_FCHMOD , req_wrap_async)
28372853AsyncCall (env, req_wrap_async, args, " fchmod" , UTF8 , AfterNoArgs,
28382854 uv_fs_fchmod, fd, mode);
@@ -2910,6 +2926,7 @@ static void FChown(const FunctionCallbackInfo<Value>& args) {
29102926
29112927if (argc > 3 ) { // fchown(fd, uid, gid, req)
29122928 FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2929+ CHECK_NOT_NULL (req_wrap_async);
29132930FS_ASYNC_TRACE_BEGIN0 (UV_FS_FCHOWN , req_wrap_async)
29142931AsyncCall (env, req_wrap_async, args, " fchown" , UTF8 , AfterNoArgs,
29152932 uv_fs_fchown, fd, uid, gid);
@@ -2940,6 +2957,7 @@ static void LChown(const FunctionCallbackInfo<Value>& args) {
29402957
29412958if (argc > 3 ) { // lchown(path, uid, gid, req)
29422959 FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
2960+ CHECK_NOT_NULL (req_wrap_async);
29432961ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
29442962 env,
29452963 req_wrap_async,
@@ -2982,6 +3000,7 @@ static void UTimes(const FunctionCallbackInfo<Value>& args) {
29823000
29833001if (argc > 3 ) { // utimes(path, atime, mtime, req)
29843002 FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
3003+ CHECK_NOT_NULL (req_wrap_async);
29853004FS_ASYNC_TRACE_BEGIN1 (
29863005UV_FS_UTIME , req_wrap_async, " path" , TRACE_STR_COPY (*path))
29873006AsyncCall (env, req_wrap_async, args, " utime" , UTF8 , AfterNoArgs,
@@ -3014,6 +3033,7 @@ static void FUTimes(const FunctionCallbackInfo<Value>& args) {
30143033
30153034if (argc > 3 ) { // futimes(fd, atime, mtime, req)
30163035 FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
3036+ CHECK_NOT_NULL (req_wrap_async);
30173037FS_ASYNC_TRACE_BEGIN0 (UV_FS_FUTIME , req_wrap_async)
30183038AsyncCall (env, req_wrap_async, args, " futime" , UTF8 , AfterNoArgs,
30193039 uv_fs_futime, fd, atime, mtime);
@@ -3046,6 +3066,7 @@ static void LUTimes(const FunctionCallbackInfo<Value>& args) {
30463066
30473067if (argc > 3 ) { // lutimes(path, atime, mtime, req)
30483068 FSReqBase* req_wrap_async = GetReqWrap (args, 3 );
3069+ CHECK_NOT_NULL (req_wrap_async);
30493070FS_ASYNC_TRACE_BEGIN1 (
30503071UV_FS_LUTIME , req_wrap_async, " path" , TRACE_STR_COPY (*path))
30513072AsyncCall (env, req_wrap_async, args, " lutime" , UTF8 , AfterNoArgs,
@@ -3078,6 +3099,7 @@ static void Mkdtemp(const FunctionCallbackInfo<Value>& args) {
30783099
30793100if (argc > 2 ) { // mkdtemp(tmpl, encoding, req)
30803101 FSReqBase* req_wrap_async = GetReqWrap (args, 2 );
3102+ CHECK_NOT_NULL (req_wrap_async);
30813103ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS (
30823104 env,
30833105 req_wrap_async,
0 commit comments