Avoid null pointer dereferences in parameter type checking.

These could occur in some situations where a K&R-style function definition followed a prototyped declaration of the function.

There should generally be no functional change, although the old code could potentially have misbehaved if the null pointer dereferences gave certain values.
This commit is contained in:
Stephen Heumann committed 2025-08-06 18:43:24 -05:00
1 parent 788d167f31
commit f25c9a9210
1 file changed
+4 -2
+4 -2
View File
@@ -2051,12 +2051,14 @@ if checkParms then begin {check for parameter type conflicts}
p1 := nil;
for i := 1 to bitdisp do begin
p2 := pfunc^.itype^.parameterList;
while (p2^.next <> p1) and (p2 <> nil) do
while (p2 <> nil) and (p2^.next <> p1) do
p2 := p2^.next;
p1 := p2;
end; {for}
compatible := false;
if CompTypes(p1^.parameterType, tPtr) then
if p1 = nil then
{not compatible}
else if CompTypes(p1^.parameterType, tPtr) then
compatible := true
else begin
tk1 := p1^.parameterType^.kind;