Attila7 How do I cheat?
Reputation: 0
Joined: 30 Aug 2011 Posts: 2
|
Posted: Tue Aug 30, 2011 2:10 pm Post subject: Bug: Dissect structure |
|
|
There is a design flaw in the way automatically generated structures are handled and user defined structures are saved - leads to CE crash.
If you define a structure ST1 at address A, have CE fill it with 4096 bytes worth of variables and then turn on auto structure generation, CE will create structure ST1 as structure 1 and add the auto generated ones at 2+.
Let's say there are 20 autogenerated structures (2-21) and you now create another structure ST2, it will be structure 22. If you now modify a pointer in ST1 and associate it to ST2, the data for ST1 will point to structure 22.
So far so good, but the problem occurs when all of this is saved to a CT file.
Only the user generated structures are saved and there will be exactly two of these, ST1 and ST2. The problem is that when ST1 is saved the data will still point to structure 22, which is not defined in the CT file.
When the CT file is loaded in a future session and ST1 is selected for an address, CE MAY crash because structure 22 does not exist. I say may, because junk data is unpredictable.
For me, the crash happened in ReadProcessMemory at line 821 in Structurefrm.pas
| Code: | //it's a defined structure (has to be a pointer)
if c=0 then typename:=definedstructures[snr].name;
if ReadProcessMemoryS(processhandle,pointer(addresses[c].address+elementoffset),@buf[0],8,x) then |
The actual problem is further up where SNR became the invalid index 22.
It is clear that the reference to structure 22 needs to be changed to 2 when ST1 is saved, but I don't have a fix for you as I just started looking at CE a few days ago and I only installed Lazarus a few hours ago and I have not seen Pascal in about 25 years.
|
|