Bug 87209 - Word binary format: FIB version stored differently from spec
Summary: Word binary format: FIB version stored differently from spec
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-10 21:16 UTC by Urmas
Modified: 2014-12-12 16:45 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Urmas 2014-12-10 21:16:08 UTC
When exporting in Word 97/2003 format, the result file has the FibBase::nFib field set to 0x101. According to spec, the maximum value for this field is 0xC1. The following versions should be stored in FibRgCswNew struct (absent in LO file).
Comment 1 Joel Madero 2014-12-12 05:42:48 UTC
Way above my head - requesting input from Robinson and/or developers on this one.

Thanks Urmas for the suggestion.

@Robinson - any thoughts on this one? If not, let me know and I'll try to track someone down :)
Comment 2 Robinson Tryon (qubit) 2014-12-12 13:03:05 UTC
(In reply to Urmas from comment #0)
> When exporting in Word 97/2003 format, the result file has the FibBase::nFib
> field set to 0x101. According to spec, the maximum value for this field is
> 0xC1. The following versions should be stored in FibRgCswNew struct (absent
> in LO file).

Word binary format spec:
http://msdn.microsoft.com/en-us/library/cc313153.aspx
http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/%5BMS-DOC%5D.pdf

According to Section "2.5.1 Fib" (pp 50, 51):

"The Fib structure contains information about the document and specifies the file pointers to various portions that make up the document."

It goes on to mention "cbRgFcLcb (2 bytes): An unsigned integer that specifies the count of 64-bit values corresponding to fibRgFcLcbBlo" and give a table that includes the following rows:

  Value of nFib  cbRgFcLcb
  0x00C1         0x005D
  ...
  0x0101         0x0088
  0x010C         0x00A4
  ...

From the table, it appears that nFib can be 0x101, as well as an even larger value. Of course, this is all based on my quick read of the spec.

Urmas: Where did you read that the max value of nFib is 0xC1?
Comment 3 Urmas 2014-12-12 15:37:38 UTC
From 2.5.2:

nFib (2 bytes): An unsigned integer that specifies the version number of the file format used. Superseded by FibRgCswNew.nFibNew if it is present. This value SHOULD be 0x00C1.
Comment 4 Robinson Tryon (qubit) 2014-12-12 16:45:17 UTC
(In reply to Urmas from comment #3)
> From 2.5.2:
> 
> nFib (2 bytes): An unsigned integer that specifies the version number of the
> file format used.

Footnote #12 sounds like they made the application and documents first, and the spec 2nd:
<12> Section 2.5.2: A special empty document is installed with Word 97, Word 2000, Word 2002, and Office Word 2003 to allow "Create New Word Document" from the operating system. This document has an nFib of 0x00C0. In addition the BiDi build of Word 97 differentiates its documents by saving 0x00C2 as the nFib. In both cases treat them as if they were 0x00C1.

*shakes head*

> Superseded by FibRgCswNew.nFibNew if it is present. This
> value SHOULD be 0x00C1.

Anyhow, I agree with Urmas' read of the spec here.

Status ->  NEW