Skip to content

Commit 30ad41f

Browse files
author
vdisasmdev
committed
* fix loading COFF strings
1 parent a463703 commit 30ad41f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

PE.COFF.pas

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ procedure TCOFF.LoadStrings(AStream: TStream);
6262
cbStringData: uint32;
6363
FileHdr: TImageFileHeader;
6464
begin
65+
Clear;
66+
6567
// 4.6. COFF String Table
6668

6769
FileHdr := TPEImage(FPE).FileHeader^;
@@ -91,8 +93,11 @@ procedure TCOFF.LoadStrings(AStream: TStream);
9193
exit;
9294

9395
// Load string block.
94-
SetLength(FStrings, cbStringData);
95-
StreamRead(AStream, FStrings[0], cbStringData);
96+
if cbStringData <> 0 then
97+
begin
98+
SetLength(FStrings, cbStringData);
99+
StreamRead(AStream, FStrings[0], cbStringData);
100+
end;
96101
end;
97102

98103
end.

0 commit comments

Comments
 (0)