fix stack overflow in jsToCString.

This commit is contained in:
ekibun
2021-01-18 14:09:15 +08:00
parent d51290b2ea
commit 2ce255bdfc
4 changed files with 11 additions and 3 deletions

View File

@@ -6,6 +6,10 @@
* @LastEditTime: 2020-12-02 11:36:40
-->
## 0.2.6
* fix stack overflow in jsToCString.
## 0.2.5
* remove dart object when jsfree.

View File

@@ -251,7 +251,11 @@ extern "C"
DLLEXPORT const char *jsToCString(JSContext *ctx, JSValueConst *val)
{
return JS_ToCString(ctx, *val);
JSRuntime *rt = JS_GetRuntime(ctx);
uint8_t *stack_top = JS_SetStackTop(rt, 0);
const char *ret = JS_ToCString(ctx, *val);
JS_SetStackTop(rt, stack_top);
return ret;
}
DLLEXPORT void jsFreeCString(JSContext *ctx, const char *ptr)

View File

@@ -82,7 +82,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.2.5"
version: "0.2.6"
flutter_test:
dependency: "direct dev"
description: flutter

View File

@@ -1,6 +1,6 @@
name: flutter_qjs
description: This plugin is a simple js engine for flutter using the `quickjs` project. Plugin currently supports all the platforms except web!
version: 0.2.5
version: 0.2.6
homepage: https://github.com/ekibun/flutter_qjs
environment: