Skip initializer processing for flexible array members.

This could result in null pointer dereferences.
This commit is contained in:
Stephen Heumann 2019-12-23 21:33:27 -06:00
parent cb063afa47
commit 4db26d14bd
1 changed files with 2 additions and 1 deletions

View File

@ -3940,6 +3940,8 @@ var
2: end;
arrayType: begin
elements := itype^.elements;
if elements = 0 then goto 1; {don't init flexible array member}
if itype^.aType^.kind = scalarType then
if itype^.aType^.baseType in [cgByte,cgUByte] then
if iPtr^.iTree^.token.kind = stringConst then begin
@ -3955,7 +3957,6 @@ var
iPtr := iPtr^.next;
goto 1;
end; {if}
elements := itype^.elements;
itype := itype^.atype;
if ZeroFill(elements, itype, count, iPtr) then begin
if itype^.kind = enumType then