anymore1113 / superobject

Automatically exported from code.google.com/p/superobject
0 stars 0 forks source link

64-bit bug report and fix #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The code below crashes or produces Out Of Memory error when compiled with 
Delphi XE6 or XE7 64-bit compiler on Windows 7.

type
  TMy = class
    arr: array of integer;
  end;

begin
  TMy.FromJson( SO('{"arr":[]}'));
end.

The bug is caused by passing the address of an Integer variable to 
DynArraySetLength which expects an address of a NativeInteger variable.

Fix:

--- superobject.pas 
+++ superobject.pas 
@@ -6141,7 +6141,7 @@

   procedure FromDynArray;
   var
-    i: Integer;
+    i: NativeInt;
     p: Pointer;
     pb: PByte;
     val: TValue;

Original issue reported on code.google.com by gerasi...@gmail.com on 11 Mar 2015 at 2:04