[Fix] nvm install: validate an inherited NVM_MAKE_JOBS like -j
A job count given with `-j` is checked by `nvm_get_make_jobs`, which rejects anything but a natural number and falls back to the detected core count. A non-empty `NVM_MAKE_JOBS` already in the environment skipped that check entirely, and was passed as-is to `make -j`, where a value like `V=1` or `-f/dev/null` is taken as a separate `make` argument. Now an inherited value that is not a natural number gets the same error and fallback as an invalid `-j`; a valid one is still used, and an empty one still triggers detection silently Discovered by Anthropic's OSS Scanner, as bug ANT-2026-SYLQD6PZ; the scanner correctly classified it as not a vulnerability.
This commit is contained in:
2 files changed
+60
-2
No files matched your search
@@ -4549,8 +4549,9 @@ nvm() {
|
||||
fi
|
||||
|
||||
if [ $EXIT_CODE -ne 0 ] && [ $nosource -ne 1 ]; then
|
||||
if [ -z "${NVM_MAKE_JOBS-}" ]; then
|
||||
nvm_get_make_jobs
|
||||
# `-j` was validated when parsed, but an inherited value was not
|
||||
if ! nvm_is_natural_num "${NVM_MAKE_JOBS-}"; then
|
||||
nvm_get_make_jobs "${NVM_MAKE_JOBS-}"
|
||||
fi
|
||||
|
||||
if [ "_${NVM_OS}" = "_win" ]; then
|
||||
|
||||
Reference in new issue
Block a user