View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0002115||JEDI VCL||00 JVCL Components||public||2004-09-03 23:57||2005-08-10 03:18|
|Target Version||Fixed in Version||3.10|
|Summary||0002115: JvInterpreter: Array to array assignment leads to Access Violation|
|Description||in JvIntepreter code:|
function main: string;
A, B: array[1..10] of integer;
A := B; // (*)
array to array assignment in Line (*) leads to AV on exit.
This is because JvInterpreterVarAssignment procedure in JvInterpreter.pas treats arrays incorrectly: instead of content copying it assigns array pointer. Note that record to record assignment is performed correctly in this procedure. I cannot propose a complete fix of this problem now but I suggest that it would be good to insert NotImplemented call into JvInterpreterVarAssignment proc:
procedure JvInterpreterVarAssignment(var Dest: Variant; const Source: Variant);
if TVarData(Source).VType = varArray then
NotImplemented('array to array assignment ');
//TVarData(Dest) := TVarData(Source) // access violation caused by this line
I believe that this "fix" will not influence other assignment logic of JvInterplreter, at least all JvInterpreter examples works with this "fix".
|Tags||No tags attached.|
||Strictly speaking, JvInterpreterVarAssignment is not accurate for records too because it does not check if Dest and Source records both have an identical type. If one declared two variables of different records type, having different number of fields, an AV is very likely if Source record has more fields then Dest (see text of JvInterpreterVarAssignment in JvInterpreter.pas).|
This is now fixed in CVS.
Please post new issues should you find ways to implement this and/or fix the problem mentionned in the note.
|2004-09-03 23:57||anonymous||New Issue|
|2004-09-06 02:38||maxp||Note Added: 0005196|
|2005-08-10 03:18||obones||Status||new => resolved|
|2005-08-10 03:18||obones||Resolution||open => fixed|
|2005-08-10 03:18||obones||Assigned To||=> obones|
|2005-08-10 03:18||obones||Note Added: 0007765|