Bug 38607 - POI corrupts sheets containing EndSubRecord due to bug in RecordInputStream
Summary: POI corrupts sheets containing EndSubRecord due to bug in RecordInputStream
Status: RESOLVED DUPLICATE of bug 41242
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: Other other
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-10 12:14 UTC by Matt Hillsdon
Modified: 2007-01-12 06:46 UTC (History)
0 users



Attachments
Simple workbook to trigger bug. (13.50 KB, application/octet-stream)
2006-02-10 12:17 UTC, Matt Hillsdon
Details
Test and proposed fix for bug. (4.51 KB, patch)
2006-02-10 12:19 UTC, Matt Hillsdon
Details | Diff
Updated fix. (5.80 KB, patch)
2006-02-10 18:32 UTC, Matt Hillsdon
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Hillsdon 2006-02-10 12:14:26 UTC
POI fails to read in the EndSubRecord.  It has an sid of 0, which
RecordInputStream treats as end of stream, so the EndSubRecord never gets added
to its parent ObjRecord.  Therefore on writing it is not serialized, resulting
in a corrupt file.

Patch and example workbook to follow.
Comment 1 Matt Hillsdon 2006-02-10 12:17:15 UTC
Created attachment 17639 [details]
Simple workbook to trigger bug.

1. Read in as HSSFWorkbook.
2. Serialize to file.
3. Open file in Excel.
4. Observe corruption.
Comment 2 Matt Hillsdon 2006-02-10 12:19:14 UTC
Created attachment 17640 [details]
Test and proposed fix for bug.

Bug fix takes most direct route, perhaps it would be better to refactor
LittleEndian to make EOF more obvious.
Comment 3 Matt Hillsdon 2006-02-10 18:32:36 UTC
Created attachment 17643 [details]
Updated fix.

Discovered 0-padding of workbooks and revised patch accordingly.  All tests now
pass.
Comment 4 Matt Hillsdon 2006-02-14 14:45:01 UTC
I've not looked at the workbook attached to the other bug but it seems like this
bug is related to BUG#35527

The fix for BUG#35527 is commented out in the current codebase (presumably
during the refactor to use RecordInputStream).
Comment 5 Yegor Kozlov 2007-01-12 06:46:43 UTC
Fixed

*** This bug has been marked as a duplicate of 41242 ***