src: added CHECK_NOT_NULL check for multiple eq_wrap_async · nodejs/node@22d4683

@@ -1149,6 +1149,7 @@ static void LStat(const FunctionCallbackInfo<Value>& args) {

11491149

bool use_bigint = args[1]->IsTrue();

11501150

if (!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);

11521153

FS_ASYNC_TRACE_BEGIN1(

11531154

UV_FS_LSTAT, req_wrap_async, "path", TRACE_STR_COPY(*path))

11541155

AsyncCall(env, req_wrap_async, args, "lstat", UTF8, AfterStat,

@@ -1191,6 +1192,7 @@ static void FStat(const FunctionCallbackInfo<Value>& args) {

11911192

bool use_bigint = args[1]->IsTrue();

11921193

if (!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);

11941196

FS_ASYNC_TRACE_BEGIN0(UV_FS_FSTAT, req_wrap_async)

11951197

AsyncCall(env, req_wrap_async, args, "fstat", UTF8, AfterStat,

11961198

uv_fs_fstat, fd);

@@ -1292,6 +1294,7 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {

1292129412931295

if (argc > 3) { // symlink(target, path, flags, req)

12941296

FSReqBase* req_wrap_async = GetReqWrap(args, 3);

1297+

CHECK_NOT_NULL(req_wrap_async);

12951298

FS_ASYNC_TRACE_BEGIN2(UV_FS_SYMLINK,

12961299

req_wrap_async,

12971300

"target",

@@ -1330,6 +1333,7 @@ static void Link(const FunctionCallbackInfo<Value>& args) {

1330133313311334

if (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

13341338

ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(

13351339

env,

@@ -1388,6 +1392,7 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) {

1388139213891393

if (argc > 2) { // readlink(path, encoding, req)

13901394

FSReqBase* req_wrap_async = GetReqWrap(args, 2);

1395+

CHECK_NOT_NULL(req_wrap_async);

13911396

FS_ASYNC_TRACE_BEGIN1(

13921397

UV_FS_READLINK, req_wrap_async, "path", TRACE_STR_COPY(*path))

13931398

AsyncCall(env, req_wrap_async, args, "readlink", encoding, AfterStringPtr,

@@ -1428,6 +1433,7 @@ static void Rename(const FunctionCallbackInfo<Value>& args) {

1428143314291434

if (argc > 2) { // rename(old_path, new_path, req)

14301435

FSReqBase* req_wrap_async = GetReqWrap(args, 2);

1436+

CHECK_NOT_NULL(req_wrap_async);

14311437

ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(

14321438

env,

14331439

req_wrap_async,

@@ -1485,6 +1491,7 @@ static void FTruncate(const FunctionCallbackInfo<Value>& args) {

1485149114861492

if (argc > 2) { // ftruncate(fd, len, req)

14871493

FSReqBase* req_wrap_async = GetReqWrap(args, 2);

1494+

CHECK_NOT_NULL(req_wrap_async);

14881495

FS_ASYNC_TRACE_BEGIN0(UV_FS_FTRUNCATE, req_wrap_async)

14891496

AsyncCall(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) {

1594160115951602

if (argc > 1) {

15961603

FSReqBase* req_wrap_async = GetReqWrap(args, 1); // rmdir(path, req)

1604+

CHECK_NOT_NULL(req_wrap_async);

15971605

FS_ASYNC_TRACE_BEGIN1(

15981606

UV_FS_RMDIR, req_wrap_async, "path", TRACE_STR_COPY(*path))

15991607

AsyncCall(env, req_wrap_async, args, "rmdir", UTF8, AfterNoArgs,

@@ -1891,6 +1899,7 @@ static void MKDir(const FunctionCallbackInfo<Value>& args) {

1891189918921900

if (argc > 3) { // mkdir(path, mode, recursive, req)

18931901

FSReqBase* req_wrap_async = GetReqWrap(args, 3);

1902+

CHECK_NOT_NULL(req_wrap_async);

18941903

FS_ASYNC_TRACE_BEGIN1(

18951904

UV_FS_UNLINK, req_wrap_async, "path", TRACE_STR_COPY(*path))

18961905

AsyncCall(env, req_wrap_async, args, "mkdir", UTF8,

@@ -1937,6 +1946,7 @@ static void RealPath(const FunctionCallbackInfo<Value>& args) {

1937194619381947

if (argc > 2) { // realpath(path, encoding, req)

19391948

FSReqBase* req_wrap_async = GetReqWrap(args, 2);

1949+

CHECK_NOT_NULL(req_wrap_async);

19401950

FS_ASYNC_TRACE_BEGIN1(

19411951

UV_FS_REALPATH, req_wrap_async, "path", TRACE_STR_COPY(*path))

19421952

AsyncCall(env, req_wrap_async, args, "realpath", encoding, AfterStringPtr,

@@ -1998,6 +2008,7 @@ static void ReadDir(const FunctionCallbackInfo<Value>& args) {

1998200819992009

if (argc > 3) { // readdir(path, encoding, withTypes, req)

20002010

FSReqBase* req_wrap_async = GetReqWrap(args, 3);

2011+

CHECK_NOT_NULL(req_wrap_async);

20012012

ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(

20022013

env,

20032014

req_wrap_async,

@@ -2245,6 +2256,7 @@ static void CopyFile(const FunctionCallbackInfo<Value>& args) {

2245225622462257

if (argc > 3) { // copyFile(src, dest, flags, req)

22472258

FSReqBase* req_wrap_async = GetReqWrap(args, 3);

2259+

CHECK_NOT_NULL(req_wrap_async);

22482260

ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(

22492261

env,

22502262

req_wrap_async,

@@ -2380,6 +2392,7 @@ static void WriteBuffers(const FunctionCallbackInfo<Value>& args) {

2380239223812393

if (argc > 3) { // writeBuffers(fd, chunks, pos, req)

23822394

FSReqBase* req_wrap_async = GetReqWrap(args, 3);

2395+

CHECK_NOT_NULL(req_wrap_async);

23832396

FS_ASYNC_TRACE_BEGIN0(UV_FS_WRITE, req_wrap_async)

23842397

AsyncCall(env,

23852398

req_wrap_async,

@@ -2764,6 +2777,7 @@ static void ReadBuffers(const FunctionCallbackInfo<Value>& args) {

2764277727652778

if (argc > 3) { // readBuffers(fd, buffers, pos, req)

27662779

FSReqBase* req_wrap_async = GetReqWrap(args, 3);

2780+

CHECK_NOT_NULL(req_wrap_async);

27672781

FS_ASYNC_TRACE_BEGIN0(UV_FS_READ, req_wrap_async)

27682782

AsyncCall(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) {

2801281528022816

if (argc > 2) { // chmod(path, mode, req)

28032817

FSReqBase* req_wrap_async = GetReqWrap(args, 2);

2818+

CHECK_NOT_NULL(req_wrap_async);

28042819

FS_ASYNC_TRACE_BEGIN1(

28052820

UV_FS_CHMOD, req_wrap_async, "path", TRACE_STR_COPY(*path))

28062821

AsyncCall(env, req_wrap_async, args, "chmod", UTF8, AfterNoArgs,

@@ -2833,6 +2848,7 @@ static void FChmod(const FunctionCallbackInfo<Value>& args) {

2833284828342849

if (argc > 2) { // fchmod(fd, mode, req)

28352850

FSReqBase* req_wrap_async = GetReqWrap(args, 2);

2851+

CHECK_NOT_NULL(req_wrap_async);

28362852

FS_ASYNC_TRACE_BEGIN0(UV_FS_FCHMOD, req_wrap_async)

28372853

AsyncCall(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) {

2910292629112927

if (argc > 3) { // fchown(fd, uid, gid, req)

29122928

FSReqBase* req_wrap_async = GetReqWrap(args, 3);

2929+

CHECK_NOT_NULL(req_wrap_async);

29132930

FS_ASYNC_TRACE_BEGIN0(UV_FS_FCHOWN, req_wrap_async)

29142931

AsyncCall(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) {

2940295729412958

if (argc > 3) { // lchown(path, uid, gid, req)

29422959

FSReqBase* req_wrap_async = GetReqWrap(args, 3);

2960+

CHECK_NOT_NULL(req_wrap_async);

29432961

ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(

29442962

env,

29452963

req_wrap_async,

@@ -2982,6 +3000,7 @@ static void UTimes(const FunctionCallbackInfo<Value>& args) {

2982300029833001

if (argc > 3) { // utimes(path, atime, mtime, req)

29843002

FSReqBase* req_wrap_async = GetReqWrap(args, 3);

3003+

CHECK_NOT_NULL(req_wrap_async);

29853004

FS_ASYNC_TRACE_BEGIN1(

29863005

UV_FS_UTIME, req_wrap_async, "path", TRACE_STR_COPY(*path))

29873006

AsyncCall(env, req_wrap_async, args, "utime", UTF8, AfterNoArgs,

@@ -3014,6 +3033,7 @@ static void FUTimes(const FunctionCallbackInfo<Value>& args) {

3014303330153034

if (argc > 3) { // futimes(fd, atime, mtime, req)

30163035

FSReqBase* req_wrap_async = GetReqWrap(args, 3);

3036+

CHECK_NOT_NULL(req_wrap_async);

30173037

FS_ASYNC_TRACE_BEGIN0(UV_FS_FUTIME, req_wrap_async)

30183038

AsyncCall(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) {

3046306630473067

if (argc > 3) { // lutimes(path, atime, mtime, req)

30483068

FSReqBase* req_wrap_async = GetReqWrap(args, 3);

3069+

CHECK_NOT_NULL(req_wrap_async);

30493070

FS_ASYNC_TRACE_BEGIN1(

30503071

UV_FS_LUTIME, req_wrap_async, "path", TRACE_STR_COPY(*path))

30513072

AsyncCall(env, req_wrap_async, args, "lutime", UTF8, AfterNoArgs,

@@ -3078,6 +3099,7 @@ static void Mkdtemp(const FunctionCallbackInfo<Value>& args) {

3078309930793100

if (argc > 2) { // mkdtemp(tmpl, encoding, req)

30803101

FSReqBase* req_wrap_async = GetReqWrap(args, 2);

3102+

CHECK_NOT_NULL(req_wrap_async);

30813103

ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(

30823104

env,

30833105

req_wrap_async,