Skip to content

Instantly share code, notes, and snippets.

@dmitry-vsl
Created November 11, 2024 01:53
Show Gist options
  • Save dmitry-vsl/c7e309a5008f78f8c47cd45644ed9910 to your computer and use it in GitHub Desktop.
Save dmitry-vsl/c7e309a5008f78f8c47cd45644ed9910 to your computer and use it in GitHub Desktop.
JS intrinsic function can cause stackoverflow (node.js)
let error
function stackoverflow() {
try {
stackoverflow()
} catch(e) {
try {
[1,2,3] // try commenting this line
} catch(e) {
error = e
}
}
}
stackoverflow()
/*
prints "RangeError: Maximum call stack size exceeded", unless you comment out
the line before. It seems that intrinsic function is called for array
construction, which causes stackoverflow error
*/
console.log(error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment