You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
util: callbackify throws when function length or name property is deleted #67745
node-e"async function fn() {} delete fn.length; util.callbackify(fn)"// deleting fn.name throws as well
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
util.callbackify(fn) should return the callbackified function without throwing (util.promisify does the same already)
What do you see instead?
node:util:422
if (typeof descriptors.length.value === 'number') {
^
TypeError: Cannot read properties of undefined (reading 'value')
at Object.callbackify (node:util:422:33)
at [eval]:1:47
at runScriptInThisContext (node:internal/vm:219:10)
at node:internal/process/execution:485:12
at [eval]-wrapper:6:24
at runScriptInContext (node:internal/process/execution:483:60)
at evalFunction (node:internal/process/execution:317:30)
at evalTypeScript (node:internal/process/execution:329:3)
at node:internal/main/eval_string:71:3
traced it. callbackify copies the original's property descriptors, then reads descriptors.length.value and descriptors.name.value without checking they exist. delete the length or name first and Object.getOwnPropertyDescriptors omits the property, so the read throws before the callbackified function is even returned. promisify already tolerates the same manipulation.
fix is up in #67754: guard both reads so a deleted property is just skipped, plus a regression test that fails on the old code and passes with the fix.
Activity
util: guard callbackify against deleted length and name properties
bunnysayzz commentedon Nov 24, 2026
traced it. callbackify copies the original's property descriptors, then reads descriptors.length.value and descriptors.name.value without checking they exist. delete the length or name first and Object.getOwnPropertyDescriptors omits the property, so the read throws before the callbackified function is even returned. promisify already tolerates the same manipulation.
fix is up in #67754: guard both reads so a deleted property is just skipped, plus a regression test that fails on the old code and passes with the fix.