Browse Source

fixed bug 51670: avoid LeftoverDataException when reading .xls files with invalid LabelRecord

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1169725 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_8_BETA5
Yegor Kozlov 12 years ago
parent
commit
936bf2f9b3

+ 1
- 0
src/documentation/content/xdocs/status.xml View File



<changes> <changes>
<release version="3.8-beta5" date="2011-??-??"> <release version="3.8-beta5" date="2011-??-??">
<action dev="poi-developers" type="add">51670 - avoid LeftoverDataException when reading .xls files with invalid LabelRecords</action>
<action dev="poi-developers" type="add">51196 - prevent NPE in XWPFPicture.getPictureData() </action> <action dev="poi-developers" type="add">51196 - prevent NPE in XWPFPicture.getPictureData() </action>
<action dev="poi-developers" type="add">51771 - prevent NPE when getting object data from OLEShape in HSLF</action> <action dev="poi-developers" type="add">51771 - prevent NPE when getting object data from OLEShape in HSLF</action>
<action dev="poi-developers" type="add">51196 - more progress with Chart APi in XSSF</action> <action dev="poi-developers" type="add">51196 - more progress with Chart APi in XSSF</action>

+ 12
- 1
src/java/org/apache/poi/hssf/record/LabelRecord.java View File

package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;


import org.apache.poi.util.HexDump; import org.apache.poi.util.HexDump;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;


/** /**
* Label Record (0x0204) - read only support for strings stored directly in the cell.. Don't * Label Record (0x0204) - read only support for strings stored directly in the cell.. Don't
* @see org.apache.poi.hssf.record.LabelSSTRecord * @see org.apache.poi.hssf.record.LabelSSTRecord
*/ */
public final class LabelRecord extends Record implements CellValueRecordInterface { public final class LabelRecord extends Record implements CellValueRecordInterface {
private final static POILogger logger = POILogFactory.getLogger(LabelRecord.class);

public final static short sid = 0x0204; public final static short sid = 0x0204;


private int field_1_row; private int field_1_row;
} else { } else {
field_6_value = ""; field_6_value = "";
} }

if (in.remaining() > 0) {
logger.log(POILogger.INFO,
"LabelRecord data remains: " + in.remaining() +
" : " + HexDump.toHex(in.readRemainder())
);
}
} }


/* /*
*/ */
public boolean isUnCompressedUnicode() public boolean isUnCompressedUnicode()
{ {
return (field_5_unicode_flag == 1);
return (field_5_unicode_flag & 0x01) != 0;
} }


/** /**

+ 6
- 0
src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java View File

assertTrue(text.contains("Bottom Right Cell")); assertTrue(text.contains("Bottom Right Cell"));
} }
} }

public void test51670() {
HSSFWorkbook wb = openSample("51670.xls");
writeOutAndReadBack(wb);
}

} }

BIN
test-data/spreadsheet/51670.xls View File


Loading…
Cancel
Save