Skip to content

Commit

Permalink
Fix crash when accessing invalid fields
Browse files Browse the repository at this point in the history
fixes #8104
  • Loading branch information
gunnarbeutner committed Dec 18, 2014
1 parent 1ff8aaa commit 28734da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/config/configitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ DynamicObject::Ptr ConfigItem::Commit(bool discard)

try {
ScriptFrame frame(dobj);
frame.Locals = m_Scope;
if (m_Scope)
m_Scope->CopyTo(frame.Locals);
m_Expression->Evaluate(frame, &debugHints);
} catch (const ScriptError& ex) {
ConfigCompilerContext::GetInstance()->AddMessage(true, ex.what(), ex.GetDebugInfo());
Expand Down
6 changes: 3 additions & 3 deletions lib/config/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ bool VariableExpression::GetReference(ScriptFrame& frame, bool init_dict, Value
if (dhint)
*dhint = NULL;
} else
*parent = frame.Locals;
*parent = frame.Self;

return true;
}
Expand Down Expand Up @@ -418,8 +418,8 @@ bool IndexerExpression::GetReference(ScriptFrame& frame, bool init_dict, Value *
String vindex;

if (m_Operand1->GetReference(frame, init_dict, &vparent, &vindex, dhint)) {
if (init_dict && VMOps::GetField(vparent, vindex).IsEmpty())
VMOps::SetField(vparent, vindex, new Dictionary());
if (init_dict && VMOps::GetField(vparent, vindex, m_Operand1->GetDebugInfo()).IsEmpty())
VMOps::SetField(vparent, vindex, new Dictionary(), m_Operand1->GetDebugInfo());

*parent = VMOps::GetField(vparent, vindex, m_DebugInfo);
} else
Expand Down

0 comments on commit 28734da

Please sign in to comment.