Recent

Author Topic: fpsreadsheet SVN 6891: segfault fix  (Read 1126 times)

vincococka

  • Full Member
  • ***
  • Posts: 101
fpsreadsheet SVN 6891: segfault fix
« on: May 13, 2019, 05:01:16 pm »
Dear community,

while using latest fpspreadsheet (SVN commit id: 6891) I encountered bug while opening Excel8 workbook (xlsbiff8 in fpsreadsheet sources).
It seems to me that the procedure FreeSharedStringTable should look like this:

procedure TsSpreadBIFF8Reader.FreeSharedStringTable;
var
  j: Integer;
begin
  if not (FSharedStringTable is TStringList) then
    Exit;

  for j := FSharedStringTable.Count-1 downto 0  do
    TObject(FSharedStringTable.Objects[j]).Free;
  FreeAndNil(FSharedStringTable);
end;

Without check "FSharedStringTable is TStringList" it always crashes, which looks like that FSharedStringTable is not initalized correctly.
Shouldn't FSharedStringTable be initialized in TsSpreadBIFF8Reader constructor ?
---
  Guide me God and I`ll find you

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: fpsreadsheet SVN 6891: segfault fix
« Reply #1 on: May 13, 2019, 05:45:55 pm »
Please try r6912. Obviously, the check for FSharedStringTable = nil is missing; it was not needed before r6911 where the method only called FreeAndNil(FSharedStringTable).

vincococka

  • Full Member
  • ***
  • Posts: 101
Re: fpsreadsheet SVN 6891: segfault fix
« Reply #2 on: May 13, 2019, 06:20:08 pm »
Hi,

thanks for quick fix, reading XLS8 works fine with SVN r6912 .

Greets,
  V.
---
  Guide me God and I`ll find you

 

TinyPortal © 2005-2018