[mw-devel] [Git][arthur/mw][master] 2 commits: js-duk: Fix stack exhaustion in event handler

Andrew Price welshbyte at sucs.org
Sat Oct 6 00:03:30 BST 2018


Andrew Price pushed to branch master at Justin Mitchell / mw


Commits:
dfa573b9 by Andrew Price at 2018-10-05T23:52:42+01:00
js-duk: Fix stack exhaustion in event handler

Fixes a duktape-triggered abort in long replays.

- - - - -
26c97b6c by Andrew Price at 2018-10-05T23:54:58+01:00
js-duk: Fix memory leak in js_push_ipcmsg_event()

json = ipcmsg_json_decode(msg) needs to be decref'd after marshalling as
it comes from a json_loads().

- - - - -


1 changed file:

- src/client/js-duk.c


Changes:

=====================================
src/client/js-duk.c
=====================================
--- a/src/client/js-duk.c
+++ b/src/client/js-duk.c
@@ -196,6 +196,7 @@ static int js_push_ipcmsg_event(ipc_message_t *msg)
 		duk_push_string(ctx, plural_suffix[p]);
 		duk_put_prop_string(ctx, idx, "suffix");
 	}
+	json_decref(json);
 	return 0;
 }
 
@@ -736,6 +737,7 @@ static int js_push_event(struct mwevent *ev)
 	 */
 	switch (ev->ev_type) {
 	case MWEV_TYPE_MSG:
+		duk_require_stack(ctx, 2);
 		duk_push_string(ctx, "message_received");
 		duk_put_prop_string(ctx, idx, "type");
 		ret = js_push_ipcmsg_event(ev->ev_data.msg);



View it on GitLab: https://projects.sucs.org/arthur/mw/compare/76808c8847eb4f404ab0c6dbb49ce53be2b74830...26c97b6cb32ecc28adfff448000fc66adb712024

-- 
View it on GitLab: https://projects.sucs.org/arthur/mw/compare/76808c8847eb4f404ab0c6dbb49ce53be2b74830...26c97b6cb32ecc28adfff448000fc66adb712024
You're receiving this email because of your account on projects.sucs.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sucs.org/pipermail/mw-devel/attachments/20181006/4f0df85c/attachment.html>


More information about the mw-devel mailing list