Repository navigation
util: guard callbackify against deleted length and name properties - #67754
bunnysayzz wants to merge 1 commit into
Conversation
Fixes: nodejs#67745 Signed-off-by: bunnysayzz <stfuazzo@gmail.com>
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. Caution AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
🚀 New features to boost your workflow:
|
| if (typeof descriptors.length.value === 'number') { | ||
| if (descriptors.length !== undefined && | ||
| typeof descriptors.length.value === 'number') { |
There was a problem hiding this comment.
alternatively, typeof descriptors.length?.value === 'number'?
callbackify throws when the original function's length or name has been deleted. Object.getOwnPropertyDescriptors omits a deleted property, so reading descriptors.length.value throws. This guards both reads so a deleted property is just skipped, same as promisify already tolerates the manipulation.
Added a regression test in test/parallel/test-util-callbackify.js. It fails on the old code and passes with the fix. Verified the fixed function in a standalone harness against Node v24.22.1 plus node --check on both files; the full build was not run here, so CI still needs to run the suite.
Fixes: #67745