nielsAD / lape

Scripting engine with Pascal-like syntax for FPC and Delphi
119 stars 28 forks source link

Fix access violations at compile time when debugging. #121

Closed ollydev closed 6 years ago

ollydev commented 6 years ago

These are only exceptions that get raised while debugging in lazarus:

ollydev commented 6 years ago

A question, the reason of this PR is to successfully run scripts in Lazarus while debugging. A problem i'm running into is DoCheckInternal raises a external SIGSEGV here.

Is there any way to handle this more safely?

nielsAD commented 6 years ago

We could pass along memory boundaries (or pass an array instead of a pointer) to RunCode to determine if something is part of the script.

nielsAD commented 6 years ago

I decided to add a check to TLapeType_Pointer.VarToString rather than changing its output. Why did you add checks to the other functions, do you have example of where they caused issues? Or are they just precautionary?

ollydev commented 6 years ago

I just tested with your commit and it seems that it resolved the issues and the nil checks are no longer needed.

ollydev commented 6 years ago

Updated the commit. Added CodeLen parameter to RunCode so we can ensure DoCheckInternal doesn't check outside of the bytecode.

nielsAD commented 6 years ago

Thanks!