Skip to content

Conversation

bnoordhuis
Copy link
Contributor

This change seems to have introduced a seemingly impossible bug in a real-world code base where values flip to JS_NULL for no discernible reason.

My best guess is something manipulating string data directly, without being aware of slice strings, but it's impossible to track down where. The weird thing is that the value flipping to null isn't even a string, it appears to be an array.

This reverts commit 08db51a. This reverts commit 62b4eed.

Fixes: #1178

This change seems to have introduced a seemingly impossible bug in a
real-world code base where values flip to JS_NULL for no discernible
reason.

My best guess is something manipulating string data directly, without
being aware of slice strings, but it's impossible to track down where.
The weird thing is that the value flipping to null isn't even a string,
it appears to be an array.

This reverts commit 08db51a.
This reverts commit 62b4eed.

Fixes: quickjs-ng#1178
@anuraaga
Copy link

Thanks @bnoordhuis - I have checked out this PR locally and can confirm it causes the error I was seeing to go away. I will confirm again after merge just in case.

The weird thing is that the value flipping to null isn't even a string, it appears to be an array

Just one point, at least based on just the error message I don't know about this, var s = "foooo"; s.slice(1)[1] is valid code that would run into that error message if the slice was null for whatever reason. Given what prettier does, format code strings, I think it's fairly reasonable that the issue is about a string.

Copy link
Contributor

@saghul saghul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢

@bnoordhuis
Copy link
Contributor Author

Found it! See #1186 for the fix.

@bnoordhuis bnoordhuis closed this Oct 11, 2025
@bnoordhuis bnoordhuis deleted the revert-string-slices branch October 11, 2025 12:07
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.

cannot read property of null with no stacktrace on latest head

3 participants