From d01824ab22275a28b32f1b9a93145cd32a333b35 Mon Sep 17 00:00:00 2001 From: florian <florian@freepascal.org> Date: Sat, 21 Jan 2012 15:17:11 +0000 Subject: [PATCH] * prevent crash of h2pas if an unknown specifier is encountered, resolves #18664 git-svn-id: trunk@20136 - --- utils/h2pas/h2pas.pas | 8 +++++--- utils/h2pas/h2pas.y | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/utils/h2pas/h2pas.pas b/utils/h2pas/h2pas.pas index 969efad1f4..88a7ed4720 100644 --- a/utils/h2pas/h2pas.pas +++ b/utils/h2pas/h2pas.pas @@ -1076,8 +1076,9 @@ program h2pas; hp3:=hp2^.p2; while assigned(hp3) do begin - if not assigned(hp3^.p1^.p3) or - (hp3^.p1^.p3^.typ <> t_size_specifier) then + if assigned(hp3^.p1) and + (not assigned(hp3^.p1^.p3) or + (hp3^.p1^.p3^.typ <> t_size_specifier)) then begin if is_sized then begin @@ -1097,7 +1098,8 @@ program h2pas; popshift; end; { size specifier or default value ? } - if assigned(hp3^.p1^.p3) then + if assigned(hp3^.p1) and + assigned(hp3^.p1^.p3) then begin { we could use mask to implement this } { because we need to respect the positions } diff --git a/utils/h2pas/h2pas.y b/utils/h2pas/h2pas.y index 003197d345..c9da9fdedd 100644 --- a/utils/h2pas/h2pas.y +++ b/utils/h2pas/h2pas.y @@ -1072,8 +1072,9 @@ program h2pas; hp3:=hp2^.p2; while assigned(hp3) do begin - if not assigned(hp3^.p1^.p3) or - (hp3^.p1^.p3^.typ <> t_size_specifier) then + if assigned(hp3^.p1) and + (not assigned(hp3^.p1^.p3) or + (hp3^.p1^.p3^.typ <> t_size_specifier)) then begin if is_sized then begin @@ -1093,7 +1094,8 @@ program h2pas; popshift; end; { size specifier or default value ? } - if assigned(hp3^.p1^.p3) then + if assigned(hp3^.p1) and + assigned(hp3^.p1^.p3) then begin { we could use mask to implement this } { because we need to respect the positions }