-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Null pointer is accessed when calling JS_EvalFunction #913
Comments
Can you submit your test case as a pull request that updates (freshly added) api-test.c? Please adhere to the code style. |
I looked into this and the problem is serializing and deserializing an unlinked module, then trying to link, evaluate and instantiate it. Context is lost during (de)serialization and looks like it's hard to preserve or recompute that. The easiest fix is rejecting unlinked modules in the serializer but that's not very convenient. Let me think if there's a better way. |
A module's imports are not serialized along with the module itself and that left the deserialized module with dangling references. Fix that by checking the module cache first, the module loader second. A glaring problem with cache checking is that the cached module doesn't have to be the module it was at the time of serialization. Why not call out to the module loader right away? Because then a module can get loaded twice and that's arguably even worse. The alternative of serializing modules transitively doesn't work for C modules and is also prone to loading the same module twice. Fixes: quickjs-ng#913
A module's imports are not serialized along with the module itself and that left the deserialized module with dangling references. Fix that by checking the module cache first, the module loader second. A glaring problem with cache checking is that the cached module doesn't have to be the module it was at the time of serialization. Why not call out to the module loader right away? Because then a module can get loaded twice and that's arguably even worse. The alternative of serializing modules transitively doesn't work for C modules and is also prone to loading the same module twice. Fixes: quickjs-ng#913
Can you check if #942 works for you? |
A module's imports are not serialized along with the module itself and that left the deserialized module with dangling references. Fix that by checking the module cache first, the module loader second. A glaring problem with cache checking is that the cached module doesn't have to be the module it was at the time of serialization. Why not call out to the module loader right away? Because then a module can get loaded twice and that's arguably even worse. The alternative of serializing modules transitively doesn't work for C modules and is also prone to loading the same module twice. Fixes: quickjs-ng#913
A module's imports are not serialized along with the module itself and that left the deserialized module with dangling references. Fix that by checking the module cache first, the module loader second. A glaring problem with cache checking is that the cached module doesn't have to be the module it was at the time of serialization. Why not call out to the module loader right away? Because then a module can get loaded twice and that's arguably even worse. The alternative of serializing modules transitively doesn't work for C modules and is also prone to loading the same module twice. Fixes: #913
I have made a minimal example of the problem I'm having. When I call JS_EvalFunction the first module is built, and then it iterates to build the array of dependent modules (I think). It iterates through req_module_entries, and req_module_entries[0].module is null in js_create_module_function().
The text was updated successfully, but these errors were encountered: