-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs: fix stat dev unsigned cast overflow #16705
Conversation
The `dev_t` is unsigned on Linux, use Integer::NewFromUnsigned to fix cast overflow Fixes: nodejs#16496
FWIW all of the values should probably just use |
@mscdex Fixed, thank you. |
I'm not sure how other @nodejs/collaborators feel about the semver-ness of the following suggestion: I think maybe we should just use |
#define X(name) \ | ||
Local<Value> name = Integer::NewFromUnsigned(env->isolate(), s->st_##name); \ | ||
Local<Value> name = Number::New(env->isolate(), \ | ||
static_cast<double>(s->st_##name)); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You removed the name.IsEmpty()
check but it should most definitely stay.
(edit: looking at the wrong diff.)
// Unsigned integers. It does not actually seem to be specified whether | ||
// uid and gid are unsigned or not, but in practice they are unsigned, | ||
// and Node’s (F)Chown functions do check their arguments for unsignedness. | ||
// Numbers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment looks pretty out of place now. Care to just remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments are added on e9ce8fc to accompany different X
macro definition. I don't think it is out of place and we are good to let it be.
The `dev_t` is unsigned on Linux, use Integer::NewFromUnsigned to fix cast overflow PR-URL: #16705 Fixes: #16496 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #16705 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
landed in 659c458...8ade20f |
The `dev_t` is unsigned on Linux, use Integer::NewFromUnsigned to fix cast overflow PR-URL: #16705 Fixes: #16496 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #16705 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This reverts commit a218422. Since nodejs/node#16705 is merged, the hotfix is unecessary. # Conflicts: # test/scripts/box/file.js
This reverts commit a218422. Since nodejs/node#16705 is merged, the hotfix is unecessary.
This reverts commit a218422. Since nodejs/node#16705 is merged, the hotfix is unecessary.
This reverts commit a218422. Since nodejs/node#16705 is merged, the hotfix is unecessary.
* Revert "hotfix(file): cast dev to uint32" This reverts commit a218422. Since nodejs/node#16705 is merged, the hotfix is unecessary. * test(appveyor): update to exact node.js version
* Revert "hotfix(file): cast dev to uint32" This reverts commit a218422. Since nodejs/node#16705 is merged, the hotfix is unecessary. * test(appveyor): update to exact node.js version
The
dev_t
is unsigned on Linux, use Integer::NewFromUnsigned to fix cast overflowFixes: #16496
Closes #16667 since this PR is a Semver-Patch alternatives regarding to #16496 only.
According to the linux headers, (http://elixir.free-electrons.com/linux/v4.13.11/source/include/linux/types.h#L15, http://elixir.free-electrons.com/linux/v4.13.11/source/include/uapi/asm-generic/posix_types.h#L23), both
dev_t
,mode_t
,nlink_t
are unsigned. UsingInteger::NewFromUnsigned
is more appropriate.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
fs