Skip to content

Commit 35b1825

Browse files
author
Felix The Cat
committed
src: added CHECK_NOT_NULL check for multiple eq_wrap_async
1 parent 5deda91 commit 35b1825

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/node_file.cc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,7 @@ static void LStat(const FunctionCallbackInfo<Value>& args) {
11431143
bool use_bigint = args[1]->IsTrue();
11441144
if (!args[2]->IsUndefined()) { // lstat(path, use_bigint, req)
11451145
FSReqBase* req_wrap_async = GetReqWrap(args, 2, use_bigint);
1146+
CHECK_NOT_NULL(req_wrap_async);
11461147
FS_ASYNC_TRACE_BEGIN1(
11471148
UV_FS_LSTAT, req_wrap_async, "path", TRACE_STR_COPY(*path))
11481149
AsyncCall(env, req_wrap_async, args, "lstat", UTF8, AfterStat,
@@ -1185,6 +1186,7 @@ static void FStat(const FunctionCallbackInfo<Value>& args) {
11851186
bool use_bigint = args[1]->IsTrue();
11861187
if (!args[2]->IsUndefined()) { // fstat(fd, use_bigint, req)
11871188
FSReqBase* req_wrap_async = GetReqWrap(args, 2, use_bigint);
1189+
CHECK_NOT_NULL(req_wrap_async);
11881190
FS_ASYNC_TRACE_BEGIN0(UV_FS_FSTAT, req_wrap_async)
11891191
AsyncCall(env, req_wrap_async, args, "fstat", UTF8, AfterStat,
11901192
uv_fs_fstat, fd);
@@ -1286,6 +1288,7 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {
12861288

12871289
if (argc > 3) { // symlink(target, path, flags, req)
12881290
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
1291+
CHECK_NOT_NULL(req_wrap_async);
12891292
FS_ASYNC_TRACE_BEGIN2(UV_FS_SYMLINK,
12901293
req_wrap_async,
12911294
"target",
@@ -1324,6 +1327,7 @@ static void Link(const FunctionCallbackInfo<Value>& args) {
13241327

13251328
if (argc > 2) { // link(src, dest, req)
13261329
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
1330+
CHECK_NOT_NULL(req_wrap_async);
13271331
// To avoid bypass the link target should be allowed to read and write
13281332
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
13291333
env,
@@ -1382,6 +1386,7 @@ static void ReadLink(const FunctionCallbackInfo<Value>& args) {
13821386

13831387
if (argc > 2) { // readlink(path, encoding, req)
13841388
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
1389+
CHECK_NOT_NULL(req_wrap_async);
13851390
FS_ASYNC_TRACE_BEGIN1(
13861391
UV_FS_READLINK, req_wrap_async, "path", TRACE_STR_COPY(*path))
13871392
AsyncCall(env, req_wrap_async, args, "readlink", encoding, AfterStringPtr,
@@ -1422,6 +1427,7 @@ static void Rename(const FunctionCallbackInfo<Value>& args) {
14221427

14231428
if (argc > 2) { // rename(old_path, new_path, req)
14241429
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
1430+
CHECK_NOT_NULL(req_wrap_async);
14251431
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
14261432
env,
14271433
req_wrap_async,
@@ -1479,6 +1485,7 @@ static void FTruncate(const FunctionCallbackInfo<Value>& args) {
14791485

14801486
if (argc > 2) { // ftruncate(fd, len, req)
14811487
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
1488+
CHECK_NOT_NULL(req_wrap_async);
14821489
FS_ASYNC_TRACE_BEGIN0(UV_FS_FTRUNCATE, req_wrap_async)
14831490
AsyncCall(env, req_wrap_async, args, "ftruncate", UTF8, AfterNoArgs,
14841491
uv_fs_ftruncate, fd, len);
@@ -1588,6 +1595,7 @@ static void RMDir(const FunctionCallbackInfo<Value>& args) {
15881595

15891596
if (argc > 1) {
15901597
FSReqBase* req_wrap_async = GetReqWrap(args, 1); // rmdir(path, req)
1598+
CHECK_NOT_NULL(req_wrap_async);
15911599
FS_ASYNC_TRACE_BEGIN1(
15921600
UV_FS_RMDIR, req_wrap_async, "path", TRACE_STR_COPY(*path))
15931601
AsyncCall(env, req_wrap_async, args, "rmdir", UTF8, AfterNoArgs,
@@ -1885,6 +1893,7 @@ static void MKDir(const FunctionCallbackInfo<Value>& args) {
18851893

18861894
if (argc > 3) { // mkdir(path, mode, recursive, req)
18871895
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
1896+
CHECK_NOT_NULL(req_wrap_async);
18881897
FS_ASYNC_TRACE_BEGIN1(
18891898
UV_FS_UNLINK, req_wrap_async, "path", TRACE_STR_COPY(*path))
18901899
AsyncCall(env, req_wrap_async, args, "mkdir", UTF8,
@@ -1931,6 +1940,7 @@ static void RealPath(const FunctionCallbackInfo<Value>& args) {
19311940

19321941
if (argc > 2) { // realpath(path, encoding, req)
19331942
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
1943+
CHECK_NOT_NULL(req_wrap_async);
19341944
FS_ASYNC_TRACE_BEGIN1(
19351945
UV_FS_REALPATH, req_wrap_async, "path", TRACE_STR_COPY(*path))
19361946
AsyncCall(env, req_wrap_async, args, "realpath", encoding, AfterStringPtr,
@@ -2240,6 +2250,7 @@ static void CopyFile(const FunctionCallbackInfo<Value>& args) {
22402250

22412251
if (argc > 3) { // copyFile(src, dest, flags, req)
22422252
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
2253+
CHECK_NOT_NULL(req_wrap_async);
22432254
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
22442255
env,
22452256
req_wrap_async,
@@ -2375,6 +2386,7 @@ static void WriteBuffers(const FunctionCallbackInfo<Value>& args) {
23752386

23762387
if (argc > 3) { // writeBuffers(fd, chunks, pos, req)
23772388
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
2389+
CHECK_NOT_NULL(req_wrap_async);
23782390
FS_ASYNC_TRACE_BEGIN0(UV_FS_WRITE, req_wrap_async)
23792391
AsyncCall(env,
23802392
req_wrap_async,
@@ -2759,6 +2771,7 @@ static void ReadBuffers(const FunctionCallbackInfo<Value>& args) {
27592771

27602772
if (argc > 3) { // readBuffers(fd, buffers, pos, req)
27612773
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
2774+
CHECK_NOT_NULL(req_wrap_async);
27622775
FS_ASYNC_TRACE_BEGIN0(UV_FS_READ, req_wrap_async)
27632776
AsyncCall(env, req_wrap_async, args, "read", UTF8, AfterInteger,
27642777
uv_fs_read, fd, *iovs, iovs.length(), pos);
@@ -2796,6 +2809,7 @@ static void Chmod(const FunctionCallbackInfo<Value>& args) {
27962809

27972810
if (argc > 2) { // chmod(path, mode, req)
27982811
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
2812+
CHECK_NOT_NULL(req_wrap_async);
27992813
FS_ASYNC_TRACE_BEGIN1(
28002814
UV_FS_CHMOD, req_wrap_async, "path", TRACE_STR_COPY(*path))
28012815
AsyncCall(env, req_wrap_async, args, "chmod", UTF8, AfterNoArgs,
@@ -2828,6 +2842,7 @@ static void FChmod(const FunctionCallbackInfo<Value>& args) {
28282842

28292843
if (argc > 2) { // fchmod(fd, mode, req)
28302844
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
2845+
CHECK_NOT_NULL(req_wrap_async);
28312846
FS_ASYNC_TRACE_BEGIN0(UV_FS_FCHMOD, req_wrap_async)
28322847
AsyncCall(env, req_wrap_async, args, "fchmod", UTF8, AfterNoArgs,
28332848
uv_fs_fchmod, fd, mode);
@@ -2905,6 +2920,7 @@ static void FChown(const FunctionCallbackInfo<Value>& args) {
29052920

29062921
if (argc > 3) { // fchown(fd, uid, gid, req)
29072922
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
2923+
CHECK_NOT_NULL(req_wrap_async);
29082924
FS_ASYNC_TRACE_BEGIN0(UV_FS_FCHOWN, req_wrap_async)
29092925
AsyncCall(env, req_wrap_async, args, "fchown", UTF8, AfterNoArgs,
29102926
uv_fs_fchown, fd, uid, gid);
@@ -2935,6 +2951,7 @@ static void LChown(const FunctionCallbackInfo<Value>& args) {
29352951

29362952
if (argc > 3) { // lchown(path, uid, gid, req)
29372953
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
2954+
CHECK_NOT_NULL(req_wrap_async);
29382955
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
29392956
env,
29402957
req_wrap_async,
@@ -2977,6 +2994,7 @@ static void UTimes(const FunctionCallbackInfo<Value>& args) {
29772994

29782995
if (argc > 3) { // utimes(path, atime, mtime, req)
29792996
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
2997+
CHECK_NOT_NULL(req_wrap_async);
29802998
FS_ASYNC_TRACE_BEGIN1(
29812999
UV_FS_UTIME, req_wrap_async, "path", TRACE_STR_COPY(*path))
29823000
AsyncCall(env, req_wrap_async, args, "utime", UTF8, AfterNoArgs,
@@ -3009,6 +3027,7 @@ static void FUTimes(const FunctionCallbackInfo<Value>& args) {
30093027

30103028
if (argc > 3) { // futimes(fd, atime, mtime, req)
30113029
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
3030+
CHECK_NOT_NULL(req_wrap_async);
30123031
FS_ASYNC_TRACE_BEGIN0(UV_FS_FUTIME, req_wrap_async)
30133032
AsyncCall(env, req_wrap_async, args, "futime", UTF8, AfterNoArgs,
30143033
uv_fs_futime, fd, atime, mtime);
@@ -3041,6 +3060,7 @@ static void LUTimes(const FunctionCallbackInfo<Value>& args) {
30413060

30423061
if (argc > 3) { // lutimes(path, atime, mtime, req)
30433062
FSReqBase* req_wrap_async = GetReqWrap(args, 3);
3063+
CHECK_NOT_NULL(req_wrap_async);
30443064
FS_ASYNC_TRACE_BEGIN1(
30453065
UV_FS_LUTIME, req_wrap_async, "path", TRACE_STR_COPY(*path))
30463066
AsyncCall(env, req_wrap_async, args, "lutime", UTF8, AfterNoArgs,
@@ -3073,6 +3093,7 @@ static void Mkdtemp(const FunctionCallbackInfo<Value>& args) {
30733093

30743094
if (argc > 2) { // mkdtemp(tmpl, encoding, req)
30753095
FSReqBase* req_wrap_async = GetReqWrap(args, 2);
3096+
CHECK_NOT_NULL(req_wrap_async);
30763097
ASYNC_THROW_IF_INSUFFICIENT_PERMISSIONS(
30773098
env,
30783099
req_wrap_async,

0 commit comments

Comments
 (0)