- changed status to resolved
Off-by-one error in TConnectorFastReadExpr.GetDataPtr
The line EvalAsVariant(exec, resultData[1]);
causes a Range Check error.
unit dwsConnectorExprs;
...
procedure TConnectorFastReadExpr.GetDataPtr(exec : TdwsExecution; var result : IDataContext);
var
resultData : TData;
begin
SetLength(resultData, 1);
EvalAsVariant(exec, resultData[1]);
exec.DataContext_Create(resultData, 0, result);
end;
Comments (6)
-
repo owner -
repo owner This appears to be dead code, did you hit the code at runtime or found the bug by looking at the code? (might make the method as abstract in that case)
-
reporter I encountered it at runtime assigning a JSONVariant member to a Variant.
ProjectProperties.Values['customer.name'] := Customer.name;
TProjectProperties.Values[]
is a Variant.
Customer
is a JSONVariant.
Customer.name
is a string.Call stack:
dwsConnectorExprs.TConnectorFastReadExpr.GetDataPtr($F67F0F0,nil)
dwsExprs.TPushOperator.ExecuteAddr($F67F0F0)
dwsExprs.TFuncExpr.DoEvalCall($F67F0F0,$D2B3590)
dwsMethodExprs.TMethodExpr.EvalAsVariant($F67F0F0,Unassigned)
dwsMethodExprs.TMethodStaticExpr.EvalAsVariant($F67F0F0,Unassigned) dwsSymbols.TExprBase.EvalNoResult($F67F0F0) -
repo owner What is the underltying method behind "TProjectProperties.Values[]" ?
I could reproduce it with a method with a const parameter like "SetValues(const arg : Variant)"
-
reporter TProjectProperties
is declared in aTdwsUnit
and implemented Delphi side.The declaration looks something like:
TProjectProperties procedure SetValue(const Name: string; const Value: Variant); property Values[const Name: string]: Variant read GetValue write SetValue;
and this is the implementation of
TProjectProperties.SetValue
:TSigmaProjectPropertySet(ExtObject).Items[Info.ParamAsString[0]] := Info.ParamAsVariant[1];
-
repo owner Ok, should be covered by the test case.
FWIW const parameters are currently executed slowly for simple datatypes (cf. Issue
#42) - Log in to comment
Fixed Issue
#40→ <<cset f475993ff9fb>>