Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002115 [JEDI VCL] 00 JVCL Components major always 2004-09-03 23:57 2005-08-10 03:18
Reporter anonymous View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version
Summary 0002115: JvInterpreter: Array to array assignment leads to Access Violation
Description in JvIntepreter code:

unit TestUnit;
function main: string;
var
  A, B: array[1..10] of integer;
begin
  A := B; // (*)
end;
end.

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);
...
begin
  if TVarData(Source).VType = varArray then
  begin
    NotImplemented('array to array assignment ');
    //TVarData(Dest) := TVarData(Source) // access violation caused by this line
  end
  else
...
...

I believe that this "fix" will not influence other assignment logic of JvInterplreter, at least all JvInterpreter examples works with this "fix".
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0005196)
maxp (reporter)
2004-09-06 02:38

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).
(0007765)
obones (administrator)
2005-08-10 03:18

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.

- Issue History
Date Modified Username Field Change
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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker