You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2004/08/21 05:36:33 UTC
DO NOT REPLY [Bug 30783] New: -
Protected Workbook Read Error
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30783>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30783
Protected Workbook Read Error
Summary: Protected Workbook Read Error
Product: POI
Version: 2.5
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: Major
Priority: Other
Component: HSSF
AssignedTo: poi-dev@jakarta.apache.org
ReportedBy: chang.zhao@c-reaction.com
Create a new Excel Document, select tools->protect workbook, and type in a
password.
This will cause
POIFSFileSystem fs = new POIFSFileSystem(i);
HSSFWorkbook wb = new HSSFWorkbook(fs); <=
to fail.
Upon investigation of this bug, it seems that a protected workbook (but not a
protected sheet) will cause the system to report length inaccurately:
i.e. in FontRecord
fillFields(byte [] data, short size, int offset)
...
field_10_font_name_len = data[ 14 + offset ];
...
on an unprotected workbook would give a sane value like 5. However, on a
protected workbook it would report a wierd value like 49. I believe the
previous bugs with ArrayOutofBoundsException s might be related to this
incorrect length reporting. This is not limited to length, other fields are
going insane as well.
Further, further investigation turns out that protected workbooks have an extra
record of type 47, length 56 right between BOF and InterfaceHeader, and it
looks like every record after that record (including the interfaceheader) got
everything scambled.
On a related note, as I was looking at FontRecord.java, in
fillFields(byte [] data, short size, int offset)
if (data[ 15 ] == 0) { // is compressed unicode
field_11_font_name = StringUtil.getFromCompressedUnicode(data, 16,
LittleEndian.ubyteToInt(field_10_font_name_len));
}
should perhaps be
if (data[ 15 + offset] == 0) {
field_11_font_name = StringUtil.getFromCompressedUnicode(data, 16 + offset,
LittleEndian.ubyteToInt(field_10_font_name_len));
}
? Or is there any reason that offset shouldn't be added?
Thanks,
CZ
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org