From a87a86727160894bb521ad2ec696367b9fb32d00 Mon Sep 17 00:00:00 2001 From: Tomas Hajny Date: Sun, 11 Apr 2010 00:37:01 +0000 Subject: [PATCH] * fix for exception handling - avoid endless loop in case of fatal exceptions, safer checking for prefetch bug git-svn-id: trunk@15131 - --- rtl/os2/system.pas | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rtl/os2/system.pas b/rtl/os2/system.pas index c8cf20b3b7..acccedf7b7 100644 --- a/rtl/os2/system.pas +++ b/rtl/os2/system.pas @@ -172,8 +172,8 @@ function Is_Prefetch (P: pointer): boolean; Is_Prefetch := false; MemSize := SizeOf (A); - DosQueryMem (P, MemSize, MemAttrs); - if (MemAttrs and (mfPag_Free or mfPag_Commit) <> 0) + if (DosQueryMem (P, MemSize, MemAttrs) = 0) and + (MemAttrs and (mfPag_Free or mfPag_Commit) <> 0) and (MemSize >= SizeOf (A)) then Move (P^, A [0], SizeOf (A)) else @@ -396,7 +396,10 @@ begin end; end; - if (Err <> 0) and (ExceptLevel < MaxExceptionLevel) then + if (Err <> 0) and (ExceptLevel < MaxExceptionLevel) +(* TH: The following line is necessary to avoid an endless loop *) + and (Report^.Exception_Num < Xcpt_Process_Terminate) + then begin ExceptEIP [ExceptLevel] := Context^.Reg_EIP; ExceptError [ExceptLevel] := Err;