Skip to content
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

Crash: calling execute() within a native function within a javascript function within execute() :P #5

Open
GoogleCodeExporter opened this issue Mar 24, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

*What steps will reproduce the problem?*
1. Add a native function "exec(s)" to a CTinyJS object, containing the 
following code:
try {
  cjs->execute( v->getParameter("s")->getString().c_str() );
} catch (CScriptException *ex) {
  v->getReturnVar()->setString( ex->text.c_str() );
}

2. Set up the concentric execution via a javascript function:
cjs->exec( "function e(s) { return exec(s); } ");

3. Test that the function ordinarily doesn't cause any problems
cjs->exec( "e(\"var f = 3\"); ");
// Doesn't cause any problems, f is a javascript integer containing the value 3

4. Test that a syntax error causes a hard crash
cjs->exec( "var f = e(\"syntaxerror\"); ");

*What is the expected output? What do you see instead?*
Expected: f is a javascript string containing some error message about 
"syntaxerror"
Result: Crash in CTinyJS::statement 

*What version of the product are you using? On what operating system?*
TinyJS trunk 0.23, Visual Studio 2010, Windows 7 (slightly old version of 
TinyJS, i can attempt to reproduce with a newer version)

*Please provide any additional information below.*
I have TinyJS hooked up to a command-line that cjs->execute()'s everything it's 
given. I have that hooked up to a chat room. I was trying to make it so that 
the bot could execute() instead of eval() commands that it was given, with all 
logic JS-side

Apologies if i've made a mistake, left something out, or if this has been fixed 
already in a newer revision..

Original issue reported on code.google.com by toaster...@gmail.com on 25 Oct 2011 at 7:58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant