[Bug 57603] New: failed to create Word 2003 with seven or more columns

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 57603] New: failed to create Word 2003 with seven or more columns

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=57603

            Bug ID: 57603
           Summary: failed to create Word 2003 with seven or more columns
           Product: POI
           Version: 3.11-FINAL
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: major
          Priority: P5
         Component: HWPF
          Assignee: [hidden email]
          Reporter: [hidden email]

Created attachment 32498
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=32498&action=edit
Test program and word documents

When HWPFDocument reads a Word document (.doc 2003) with six columns, writes a
new document without problem. If Word document has seven or more columns, the
write process creates a corrupt document, that MSWord can't read it.

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 57603] failed to create Word 2003 with seven or more columns

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=57603

E.G.Miranda <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|Windows NT                  |All

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 57603] failed to create Word 2003 with seven or more columns

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=57603

[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--- Comment #1 from [hidden email] ---
Created attachment 33408
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33408&action=edit
Empty document with a seven column table

This bug is also occurring with the latest Apache POI 3.14-beta1 on an empty
document that is written without modifications.

To reproduce, you only need to open the attached file and write it back :
        HWPFDocument doc = new HWPFDocument(new FileInputStream(inFile));
        FileOutputStream fos = new FileOutputStream(outFile);
        doc.write(fos);
        fos.close();

Word then displays an error when the output file is opened.

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 57603] failed to create Word 2003 with seven or more columns

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=57603

--- Comment #2 from [hidden email] ---
After doing some additional tests, it seems that writing such a file and
opening it again leads to an Exception. Here is a small testcase that reproduce
the error using the previously attached document :

    public void testSevenRowTable() throws Exception
    {
        HWPFDocument hwpfDocument = new HWPFDocument( POIDataSamples
                .getDocumentInstance().openResourceAsStream(
"Bug57603-sevencolumns.doc" ) );

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        hwpfDocument.write(out);
        out.close();

        HWPFDocument hwpfDocument2 = new HWPFDocument(new
ByteArrayInputStream(out.toByteArray()));
    }

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 57603] failed to create Word 2003 with seven or more columns

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=57603

--- Comment #3 from Dominik Stadler <[hidden email]> ---
I have added a disabled unit-test for this via r1753120.

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 57603] failed to create Word 2003 with seven or more columns

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=57603

Dominik Stadler <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marko.zupancic@mikrografija
                   |                            |.si

--- Comment #4 from Dominik Stadler <[hidden email]> ---
*** Bug 55541 has been marked as a duplicate of this bug. ***

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 57603] failed to create Word 2003 with seven or more columns

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=57603

--- Comment #5 from [hidden email] ---
Created attachment 37753
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37753&action=edit
Patch demonstrating exception resolution

I believe the root cause to be that PAPBinTable#writeTo() uses the tableStream
on line 408. It should be the dataStream.

7 columns appears to cause the creation of a "huge grpprl". According to
MS-DOC, those are stored in the dataStream (search spec for sprmPHugePapx).

I have a relatively simple way of making the exception not happen. However,
given that there is no support at the moment for saving any content in the
dataStream that has been altered, it is possible that changes made to the
document would be silently lost during the save. It is also possible that this
might corrupt the document.

During the save, the contents of the huge grpprl get written to the dataStream,
and a pointer to the location of the huge grpprl is modified in the
PAPFormattedDiskPage. That pointer, if it were to be saved (and I'm not sure it
is) would be incorrect since we reuse the old dataStream during save.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]