Repository navigation
Let the deadline cover reading the result - #10
Merged
Merged
Conversation
The deadline ended with the evaluation, but Pharo reads the result afterwards and reading runs JS too: a getter on the result, a script that replaced Object.keys, or a looping toString on a thrown error ran without any deadline and held the VM for good. Reading plain data runs no JS at all, so a cyclic object or a few hundred bytes of shared arrays (a = [a, a], forty times) kept Pharo busy without end as well. - The deadline outlives the evaluation until the next one sets a new one, so JS run while reading stops once it has passed. - qjs_object_keys takes the keys through JS_GetOwnPropertyNames instead of the global Object.keys. - qjs_array_length answers -1 with the exception pending instead of 0. - qjs_runtime_deadline_passed lets Pharo ask in between; QJSContext checks it for every element it reads and refuses values nested deeper than 1000 levels. - QJSSandboxTest pins down what a script can reach: the globals against a fixed list, no std, os, print or require, no import, no blocking Atomics.wait, recursion ends at the stack limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The deadline ended with the evaluation, but Pharo reads the result afterwards and reading runs JS too: a getter on the result, a script that replaced Object.keys, or a looping toString on a thrown error ran without any deadline and held the VM for good. Reading plain data runs no JS at all, so a cyclic object or a few hundred bytes of shared arrays (a = [a, a], forty times) kept Pharo busy without end as well.