From fba3ff5c20aec89b9affba30cf51491f78f6ad11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ant=C3=B4nio=20Duarte?= Date: Mon, 17 Jun 2024 08:12:51 -0300 Subject: [PATCH] Prevent access violation on GetVarValue --- Source/PascalScript_Core_D27.dpk | 8 ++++---- Source/PascalScript_Core_D27.dproj | 13 +++++-------- Source/uPSComponent.pas | 17 ++++++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Source/PascalScript_Core_D27.dpk b/Source/PascalScript_Core_D27.dpk index 8c8d112b..dc514938 100644 --- a/Source/PascalScript_Core_D27.dpk +++ b/Source/PascalScript_Core_D27.dpk @@ -9,13 +9,13 @@ package PascalScript_Core_D27; {$EXTENDEDSYNTAX ON} {$IMPORTEDDATA ON} {$IOCHECKS ON} -{$LOCALSYMBOLS ON} +{$LOCALSYMBOLS OFF} {$LONGSTRINGS ON} {$OPENSTRINGS ON} -{$OPTIMIZATION OFF} +{$OPTIMIZATION ON} {$OVERFLOWCHECKS OFF} {$RANGECHECKS OFF} -{$REFERENCEINFO ON} +{$REFERENCEINFO OFF} {$SAFEDIVIDE OFF} {$STACKFRAMES ON} {$TYPEDADDRESS OFF} @@ -23,7 +23,7 @@ package PascalScript_Core_D27; {$WRITEABLECONST OFF} {$MINENUMSIZE 1} {$IMAGEBASE $400000} -{$DEFINE DEBUG} +{$DEFINE RELEASE} {$ENDIF IMPLICITBUILDING} {$DESCRIPTION 'RemObjects Pascal Script - Core Package'} {$IMPLICITBUILD OFF} diff --git a/Source/PascalScript_Core_D27.dproj b/Source/PascalScript_Core_D27.dproj index fca676da..8917b0eb 100644 --- a/Source/PascalScript_Core_D27.dproj +++ b/Source/PascalScript_Core_D27.dproj @@ -5,7 +5,7 @@ True Release DCC32 - 19.0 + 19.2 VCL Win32 Package @@ -64,16 +64,10 @@ System.Win;$(DCC_Namespace) - ..\Dcu\D27\win32 - ..\Dcu\D27\win32;$(DCC_UnitSearchPath) - ..\Dcu\D27\win32 ..\Dcu\D27\win32 vcl;PascalScript_Core_D27;$(DCC_UsePackage) - ..\Dcu\D27\win64 - ..\Dcu\D27\win64;$(DCC_UnitSearchPath) - ..\Dcu\D27\win64 ..\Dcu\D27\win64 System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) vcl;$(DCC_UsePackage) @@ -189,7 +183,10 @@ Friday, March 21, 2008 1:24 PM - + + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + True diff --git a/Source/uPSComponent.pas b/Source/uPSComponent.pas index 6b906c96..2deb67dd 100644 --- a/Source/uPSComponent.pas +++ b/Source/uPSComponent.pas @@ -1336,15 +1336,18 @@ function TPSScriptDebugger.GetVarValue(const Name: tbtstring): Pointer; s := ''; end; pv := nil; - for i := 0 to Exec.CurrentProcVars.Count -1 do + if Exec.CurrentProcVars <> nil then begin - if Uppercase(Exec.CurrentProcVars[i]) = s1 then + for i := 0 to Exec.CurrentProcVars.Count -1 do begin - pv := Exec.GetProcVar(i); - break; + if Uppercase(Exec.CurrentProcVars[i]) = s1 then + begin + pv := Exec.GetProcVar(i); + break; + end; end; end; - if pv = nil then + if (pv = nil) and (Exec.CurrentProcParams <> nil) then begin for i := 0 to Exec.CurrentProcParams.Count -1 do begin @@ -1355,11 +1358,11 @@ function TPSScriptDebugger.GetVarValue(const Name: tbtstring): Pointer; end; end; end; - if pv = nil then + if (pv = nil) and (Exec.GlobalVarNames <> nil) then begin for i := 0 to Exec.GlobalVarNames.Count -1 do begin - if Uppercase(Exec.GlobalVarNames[i]) = s1 then + if Uppercase(Exec.GlobalVarNames[i]) = s1 then begin pv := Exec.GetGlobalVar(i); break;