fpspreadsheet: Fix xls reader crashing if comment has record sequence OBJ-CONTINUE-TX0-CONTINUE instead of OBJ-TX0-CONTINUE.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6214 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-02-26 22:20:06 +00:00
parent 659b19e80f
commit 6aedb395f4

View File

@ -537,7 +537,7 @@ var
comment: TBIFF8Comment;
rtParams: TsRichTextParams;
begin
if FCommentPending then begin
if FCommentPending and (FCommentLen > 0) then begin
commentStr := Utf8Encode(ReadWideString(AStream, FCommentLen, rtParams));
if commentStr <> '' then
begin
@ -605,6 +605,7 @@ begin
if objType = $19 then begin // $19 = object is a "comment"
FCommentPending := true;
FCommentID := objID;
FCommentLen := 0; // will be determined in following TX0 record
exit;
end else
FCommentPending := false;
@ -886,6 +887,9 @@ begin
RecordSize := WordLEToN(AStream.ReadWord);
PendingRecordSize := RecordSize;
// For debugging to find out in which record a crash happens:
// WriteLn(Format('Stream.Pos: %d, RecordType: $%.04x, RecordSize: %d', [AStream.Position-4, RecordType, RecordSize]));
CurStreamPos := AStream.Position;
case RecordType of