Skip to content

QuickJS: added error checks in modules initialization. #869

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

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

VadimZhestikov
Copy link
Contributor

No description provided.

xeioex
xeioex previously requested changes Mar 19, 2025
Copy link
Contributor

@xeioex xeioex left a comment

Choose a reason for hiding this comment

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

The fs module part seems missing

diff --git a/external/qjs_fs_module.c b/external/qjs_fs_module.c
index 9d1f7687..b09d1dcd 100644
--- a/external/qjs_fs_module.c
+++ b/external/qjs_fs_module.c
@@ -2960,6 +2960,10 @@ qjs_fs_module_init(JSContext *cx, JSModuleDef *m)
     JSValue  proto;
 
     proto = JS_NewObject(cx);
+    if (JS_IsException(proto)) {
+        return -1;
+    }
+
     JS_SetPropertyFunctionList(cx, proto, qjs_fs_export,
                                njs_nitems(qjs_fs_export));
 
@@ -3031,7 +3035,10 @@ qjs_fs_init(JSContext *cx, const char *name)
         return NULL;
     }
 
-    JS_AddModuleExport(cx, m, "default");
+    if (JS_AddModuleExport(cx, m, "default") < 0) {
+        return NULL;
+    }
+
     rc = JS_AddModuleExportList(cx, m, qjs_fs_export,
                                 njs_nitems(qjs_fs_export));
     if (rc != 0) {

We use passive voice in commit logs
QuickJS: added error checks in modules initialization.

Otherwise looks good.

@VadimZhestikov VadimZhestikov force-pushed the add_missed_error_checks branch from 0f7e7f8 to b3827e6 Compare March 19, 2025 02:32
@VadimZhestikov VadimZhestikov force-pushed the add_missed_error_checks branch from b3827e6 to 0ed1cca Compare March 19, 2025 02:36
@VadimZhestikov VadimZhestikov dismissed xeioex’s stale review March 19, 2025 02:41

yep, it was draft. now it is complete.

@VadimZhestikov VadimZhestikov requested a review from xeioex March 19, 2025 02:41
@VadimZhestikov VadimZhestikov changed the title QuickJS: add error checks in modules initialization. QuickJS: added error checks in modules initialization. Mar 19, 2025
@VadimZhestikov VadimZhestikov marked this pull request as ready for review March 19, 2025 03:13
@VadimZhestikov VadimZhestikov merged commit 6736121 into nginx:master Mar 19, 2025
1 check passed
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.

2 participants