Size of script code buffer
Hello.
Code buffer size argument of jerry_api_eval in JHANDLER_FUNCTION(Compile, handler) and JHANDLER_FUNCTION(CompileNativePtr, handler) is calculated incorrectly : sizeof (code) equals to size of pointer, not buffer size.
Maybe, this could be fixed with the following:
diff --git a/src/iotjs_module_process.cpp b/src/iotjs_module_process.cpp
index 282bc09..bd73a3f 100644
--- a/src/iotjs_module_process.cpp
+++ b/src/iotjs_module_process.cpp
@@ -87,7 +87,7 @@ JHANDLER_FUNCTION(Compile, handler){
char* code = handler.GetArg(0)->GetCString();
JRawValueType ret_val;
- jerry_api_eval(code,sizeof(code),true,false,&ret_val);
+ jerry_api_eval(code,strlen(code),true,false,&ret_val);
JObject::ReleaseCString(code);
JObject ret(&ret_val);
@@ -116,7 +116,7 @@ JHANDLER_FUNCTION(CompileNativePtr, handler){
strcat(code,wrapper[1]);
JRawValueType ret_val;
- jerry_api_eval(code,sizeof(code),true,false,&ret_val);
+ jerry_api_eval(code,len,true,false,&ret_val);
JObject::ReleaseCString(code);
JObject ret(&ret_val);
@ruben-ayrapetyan Thanks for pointing it out.
@ruben-ayrapetyan Thank you. I will fix it
Is #47 probably relevant to this?
I dont think so.
It seems like second argument of jerry_api_eval function is not used in jerry_api_eval.
Especially ecma_new_ecma_string(source_p, source_size); function inside jerry_api_eval do not use source_size parameter
@chunseoklee Thanks Close this issue as #60 landed.