You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library is not functioning correctly on iOS 64 bit targets (ARM64). All other targets seem to work fine. I have some sample code at the end of this post.
I have dug a bit and found this so far:
class procedure TJsonBaseObject.StrToJSONStr(const AppendMethod: TWriterAppendMethod; const S: string);
2266: //EndP := P + Length(S);
2267: EndP := P + PLongInt(@PByte(S)[-4])^;
Line 2267 is calculating huge EndP values in ARM64 and causing the while loops to crash. However, if I comment out line 2267 and use line 2266 then EndP correctly points to the line end.
In ARM64 after line 6803 executes S is not updated and still points to the blank text it was initialized to earlier in this method. Line 6803 seems to have no effect when investigated in the debugger.
Sample code:
procedure TForm1.Button1Click(Sender: TObject);
var
jo: TJSONObject;
begin
jo := TJSONObject.Create;
Memo1.Text := jo.ToJSON(true);
// Crash if line 2267 is active, no crash if line 2266 is active.
// When no crash then this always returns an empty string.
jo.Free;
end;
The text was updated successfully, but these errors were encountered:
I don't have any Apple device so I can't test it. I can only make assumptions. So fixing those bugs may take some time and commits.
Embarcadero made LongWord and LongInt for ARM64 incompatible to Win32, ARM32 and Win64. In my opinion they broke it. On ARM64 SizeOf(LongInt) is 8, for all other platforms including Win64 it is 4.
Hi Andy,
This library is not functioning correctly on iOS 64 bit targets (ARM64). All other targets seem to work fine. I have some sample code at the end of this post.
I have dug a bit and found this so far:
Line 2267 is calculating huge EndP values in ARM64 and causing the while loops to crash. However, if I comment out line 2267 and use line 2266 then EndP correctly points to the line end.
Next:
In ARM64 after line 6803 executes S is not updated and still points to the blank text it was initialized to earlier in this method. Line 6803 seems to have no effect when investigated in the debugger.
Sample code:
procedure TForm1.Button1Click(Sender: TObject);
var
jo: TJSONObject;
begin
jo := TJSONObject.Create;
jo.I['ACCOUNTID'] := 225;
jo.B['BOOLVAL'] := False;
jo.S['VERSION'] := '1.0';
jo.S['LOCATION'] := 'RVK';
jo.S['USERID'] := 'S.TESTER';
jo.S['GARBAGE#####'] := 'Ooga\booga';
jo.S['SUBTOCALL'] := 'G2.WEB.CONNECT.SUB';
jo.D['DT'] := Now;
jo.S['ACTION'] := 'CONNECT';
Memo1.Text := jo.ToJSON(true);
// Crash if line 2267 is active, no crash if line 2266 is active.
// When no crash then this always returns an empty string.
jo.Free;
end;
The text was updated successfully, but these errors were encountered: