Skip to content
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

Fix crash resulting from improper use of stack #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rscarson
Copy link

@rscarson rscarson commented Sep 8, 2023

Encountered a case where this package errors out due to an attempt to read the stack without checking if it is empty

The error originates here:

            while (true) {
                [parent, parentCount] = stack[stack.length - 1];
[...]

In the edge-case I encountered, that line resulted in the error below. replacing while(true) with while(stack.length) prevents a crash.

Full error:

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
 ❯ RangeTree.fromSortedRanges node_modules/@bcoe/v8-coverage/dist/lib/range-tree.js:27:39
 ❯ normalizeFunctionCov node_modules/@bcoe/v8-coverage/dist/lib/normalize.js:74:41
 ❯ Object.deepNormalizeScriptCov node_modules/@bcoe/v8-coverage/dist/lib/normalize.js:59:9
 ❯ mergeScriptCovs node_modules/@bcoe/v8-coverage/dist/lib/merge.js:59:21
 ❯ mergeProcessCovs node_modules/@bcoe/v8-coverage/dist/lib/merge.js:34:21
 ❯ V8CoverageProvider.reportCoverage node_modules/@vitest/coverage-v8/dist/provider.js:217:20
 ❯ Vitest.reportCoverage node_modules/vitest/dist/vendor-node.5ce5f335.js:11384:35
 ❯ Vitest.start node_modules/vitest/dist/vendor-node.5ce5f335.js:11090:16
 ❯ startVitest node_modules/vitest/dist/vendor-node.5ce5f335.js:18061:5
 ❯ start node_modules/vitest/dist/cli.js:135:17

@rscarson
Copy link
Author

Just checking on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant