diff --git a/components/fpdebug/fpdbgdwarfcfi.pas b/components/fpdebug/fpdbgdwarfcfi.pas index 8f5b7e4e87..751fceea31 100644 --- a/components/fpdebug/fpdbgdwarfcfi.pas +++ b/components/fpdebug/fpdbgdwarfcfi.pas @@ -261,6 +261,11 @@ var uparam1, uparam2: QWord; sparam: Int64; begin + if Length(Instructions) = 0 then + begin + Result := True; + Exit; + end; Result := False; if Instructions=nil then exit; p := @Instructions[0]; diff --git a/components/fpdebug/fpdbgdwarfdataclasses.pas b/components/fpdebug/fpdbgdwarfdataclasses.pas index f8e5391e99..7e32cebbf5 100644 --- a/components/fpdebug/fpdbgdwarfdataclasses.pas +++ b/components/fpdebug/fpdbgdwarfdataclasses.pas @@ -3935,8 +3935,11 @@ var // initial instructions') Dec(SizeLeft, p-Augmentation); SetLength(Instructions, SizeLeft); - Move(p^, Instructions[0], SizeLeft); - Result.InitialInstructions := Instructions; + if SizeLeft > 0 then + begin + Move(p^, Instructions[0], SizeLeft); + Result.InitialInstructions := Instructions; + end; end; function LoadFDE(CFI: TDwarfCallFrameInformation; CIEPointer: QWord; InitialLocationAddr: pointer; SizeLeft: QWord): TDwarfFDE;