Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 3fd5d60

Browse files
author
livecodeali
committed
Merge remote-tracking branch 'upstream/develop-7.0' into merge-7.0.6-rc-1
Conflicts: engine/src/exec-engine.cpp ide
2 parents f5813f8 + ae87210 commit 3fd5d60

28 files changed

+424
-275
lines changed

docs/notes/bugfix-15416.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Crash when building a SQLite query with out-of-bounds placeholders

docs/notes/bugfix-15432.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Filename of stack not properly handling tilde character

docs/notes/bugfix-15455.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# custom property gets truncated if it contains a NULL byte

docs/notes/bugfix-9820.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# LiveCode Server provides no POST data when Content-Type is application/x-www-form-urlencoded; charset=<...>

engine/src/cmds.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,8 @@ void MCDo::exec_ctxt(MCExecContext& ctxt)
487487
// MW-2013-11-15: [[ Bug 11277 ]] If no handler, then evaluate in context of the
488488
// server script object.
489489
Exec_stat stat;
490-
if (ep . gethandler() != nil)
491-
stat = ep.gethandler()->doscript(*epptr, line, pos);
492-
else
493-
stat = ep.gethlist()->doscript(*epptr, line, pos);
490+
stat = ep.doscript(*epptr, line, pos);
491+
494492
if (added)
495493
MCnexecutioncontexts--;
496494
return stat;
@@ -3028,4 +3026,4 @@ void MCAssertCmd::exec_ctxt(MCExecContext& ctxt)
30283026
void MCAssertCmd::compile(MCSyntaxFactoryRef ctxt)
30293027
{
30303028

3031-
}
3029+
}

engine/src/cmdse.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,13 +1294,10 @@ void MCMessage::exec_ctxt(MCExecContext &ctxt)
12941294

12951295
// MW-2011-08-11: [[ Bug 9668 ]] Make sure we copy 'pdata' if we use it, since
12961296
// mptr (into which it points) only lasts as long as this method call.
1297-
// MW-2013-11-15: [[ Bug 11277 ]] If no handler, evaluate in the context of the
1298-
// server script object.
1297+
// MW-2013-11-15: [[ Bug 11277 ]] Refactor MCHandler::eval
12991298
Exec_stat t_stat;
1300-
if (ep.gethandler() != nil)
1301-
t_stat = ep . gethandler() -> eval(ep);
1302-
else
1303-
t_stat = ep . gethlist() -> eval(ep);
1299+
t_stat = ep . eval(ep);
1300+
13041301
if (t_stat == ES_NORMAL)
13051302
newparam->set_argument(ep);
13061303
else

engine/src/dispatch.cpp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -970,28 +970,18 @@ IO_stat MCDispatch::doreadfile(MCStringRef p_openpath, MCStringRef p_name, IO_ha
970970

971971
IO_stat MCDispatch::loadfile(MCStringRef p_name, MCStack *&sptr)
972972
{
973-
IO_handle stream;
973+
IO_handle stream;
974974
MCAutoStringRef t_open_path;
975975

976976
bool t_found;
977977
t_found = false;
978978
if (!t_found)
979979
{
980980
if ((stream = MCS_open(p_name, kMCOpenFileModeRead, True, False, 0)) != NULL)
981-
{
982-
// This should probably use resolvepath().
983-
if (MCStringGetCharAtIndex(p_name, 0) != PATH_SEPARATOR
984-
&& MCStringGetCharAtIndex(p_name, 1) != ':')
985-
{
986-
MCAutoStringRef t_curpath;
987-
988-
/* UNCHECKED */ MCS_getcurdir(&t_curpath);
989-
/* UNCHECKED */ MCStringFormat(&t_open_path, "%@/%@", *t_curpath, p_name);
990-
}
991-
else
992-
t_open_path = p_name;
993-
994-
t_found = true;
981+
{
982+
// This should probably use resolvepath().
983+
// SN-2015-06-03: [[ Bug 15432 ]] Use resolvepath
984+
t_found = MCS_resolvepath(p_name, &t_open_path);
995985
}
996986
}
997987

@@ -1006,7 +996,7 @@ IO_stat MCDispatch::loadfile(MCStringRef p_name, MCStack *&sptr)
1006996
else
1007997
t_leaf_name = p_name;
1008998
if ((stream = MCS_open(*t_leaf_name, kMCOpenFileModeRead, True, False, 0)) != NULL)
1009-
{
999+
{
10101000
MCAutoStringRef t_curpath;
10111001
/* UNCHECKED */ MCS_getcurdir(&t_curpath);
10121002
/* UNCHECKED */ MCStringFormat(&t_open_path, "%@/%@", *t_curpath, p_name);

engine/src/exec-debugging.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void MCDebuggingExecDebugDo(MCExecContext& ctxt, MCStringRef p_script, uinteger_
7878
MCExecContext *t_ctxt_ptr;
7979
t_ctxt_ptr = MCexecutioncontexts[MCdebugcontext];
8080

81-
t_ctxt_ptr->GetHandler()->doscript(*t_ctxt_ptr, p_script, p_line, p_pos);
81+
t_ctxt_ptr->doscript(*t_ctxt_ptr, p_script, p_line, p_pos);
8282

8383
// AL-2014-03-21: [[ Bug 11940 ]] Ensure the debug context is not permanently in a state of error.
8484
t_ctxt_ptr -> IgnoreLastError();
@@ -404,7 +404,9 @@ void MCDebuggingExecAssert(MCExecContext& ctxt, int type, bool p_eval_success, b
404404

405405
// Dispatch 'assertError <handler>, <line>, <pos>, <object>'
406406
MCParameter t_handler, t_line, t_pos, t_object;
407-
t_handler.setvalueref_argument(ctxt .GetHandler() -> getname());
407+
if (ctxt . GetHandler() != NULL) {
408+
t_handler.setvalueref_argument(ctxt . GetHandler() -> getname());
409+
}
408410
t_handler.setnext(&t_line);
409411
t_line.setn_argument((real8)ctxt . GetLine());
410412
t_line.setnext(&t_pos);

engine/src/exec-engine.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,11 @@ void MCEngineEvalParam(MCExecContext& ctxt, integer_t p_index, MCValueRef& r_val
446446
void MCEngineEvalParamCount(MCExecContext& ctxt, integer_t& r_count)
447447
{
448448
// MW-2013-11-15: [[ Bug 11277 ]] If we don't have a handler then 'the param'
449-
// makes no sense so just return 0.
450-
// PM-2014-04-14: [[Bug 12105]] Do this check to prevent crash in LC server
449+
// makes no sense so just return 0.
451450
if (ctxt.GetHandler() != nil)
452451
r_count = ctxt.GetHandler()->getnparams();
453452
else
454-
ctxt . LegacyThrow(EE_PARAMCOUNT_NOHANDLER);
453+
r_count = 0;
455454
}
456455

457456
void MCEngineEvalParams(MCExecContext& ctxt, MCStringRef& r_string)
@@ -652,10 +651,9 @@ void MCEngineEvalValue(MCExecContext& ctxt, MCStringRef p_script, MCValueRef& r_
652651
return;
653652
}
654653

655-
if (ctxt.GetHandler() != nil)
656-
ctxt.GetHandler()->eval(ctxt, p_script, r_value);
657-
else
658-
ctxt.GetHandlerList()->eval(ctxt, p_script, r_value);
654+
// SN-2015-06-03: [[ Bug 11277 ]] MCHandler::eval refactored
655+
ctxt.eval(ctxt, p_script, r_value);
656+
659657
if (ctxt.HasError())
660658
ctxt.LegacyThrow(EE_VALUE_ERROR, p_script);
661659
}
@@ -853,10 +851,8 @@ void MCEngineExecDo(MCExecContext& ctxt, MCStringRef p_script, int p_line, int p
853851
added = True;
854852
}
855853

856-
if (ctxt.GetHandler() != nil)
857-
ctxt.GetHandler() -> doscript(ctxt, p_script, p_line, p_pos);
858-
else
859-
ctxt.GetHandlerList() -> doscript(ctxt, p_script, p_line, p_pos);
854+
// SN-2015-06-03: [[ Bug 11277 ]] MCHandler::doscript refactored
855+
ctxt.doscript(ctxt, p_script, p_line, p_pos);
860856

861857
if (added)
862858
MCnexecutioncontexts--;
@@ -882,10 +878,8 @@ void MCEngineExecDoInCaller(MCExecContext& ctxt, MCStringRef p_script, int p_lin
882878

883879
MCExecContext *caller = MCexecutioncontexts[MCnexecutioncontexts - 2];
884880

885-
if (caller -> GetHandler() != nil)
886-
caller -> GetHandler() -> doscript(*caller, p_script, p_line, p_pos);
887-
else
888-
caller -> GetHandlerList() -> doscript(*caller, p_script, p_line, p_pos);
881+
// SN-2015-06-03: [[ Bug 11277 ]] MCHandler::doscript refactored
882+
caller -> doscript(*caller, p_script, p_line, p_pos);
889883

890884
if (added)
891885
MCnexecutioncontexts--;
@@ -1307,8 +1301,9 @@ static void MCEngineSplitScriptIntoMessageAndParameters(MCExecContext& ctxt, MCS
13071301

13081302
// MW-2011-08-11: [[ Bug 9668 ]] Make sure we copy 'pdata' if we use it, since
13091303
// mptr (into which it points) only lasts as long as this method call.
1304+
// SN-2015-06-03: [[ Bug 11277 ]] MCHandler::eval_ctxt refactored
13101305
MCExecValue t_value;
1311-
ctxt . GetHandler() -> eval_ctxt(ctxt, *t_expression, t_value);
1306+
ctxt . eval_ctxt(ctxt, *t_expression, t_value);
13121307
if (!ctxt.HasError())
13131308
newparam->set_exec_argument(ctxt, t_value);
13141309
else
@@ -2000,3 +1995,4 @@ void MCEngineGetEditionType(MCExecContext& ctxt, MCStringRef& r_edition)
20001995
}
20011996

20021997
////////////////////////////////////////////////////////////////////////////////
1998+

engine/src/exec-strings.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,17 +1395,14 @@ bool MCStringsMerge(MCExecContext& ctxt, MCStringRef p_format, MCStringRef& r_st
13951395
MCerrorlock++;
13961396
if (t_is_expression)
13971397
{
1398-
if (ctxt . GetHandler() != nil)
1399-
ctxt.GetHandler()->eval(t_ctxt, *t_expression, &t_value);
1400-
else
1401-
ctxt.GetHandlerList()->eval(t_ctxt, *t_expression, &t_value);
1398+
// SN-2015-06-03: [[ Bug 11277 ]] MCHandler::eval refactored
1399+
ctxt.eval(t_ctxt, *t_expression, &t_value);
14021400
}
14031401
else
1404-
{
1405-
if (ctxt . GetHandler() != nil)
1406-
ctxt.GetHandler()->doscript(t_ctxt, *t_expression);
1407-
else
1408-
ctxt.GetHandlerList()->doscript(t_ctxt, *t_expression);
1402+
{
1403+
// SN-2015-06-03: [[ Bug 11277 ]] MCHandler::doscript refactored
1404+
ctxt.doscript(t_ctxt, *t_expression, 0, 0);
1405+
14091406
t_value = MCresult->getvalueref();
14101407
// SN-2014-08-11: [[ Bug 13139 ]] The result must be emptied after a doscript()
14111408
ctxt . SetTheResultToEmpty();

0 commit comments

Comments
 (0)