fix for issues 34575 and 35527 { fillFields(..) modified }

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353739 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Amol S. Deshmukh 2005-07-06 22:01:13 +00:00
parent feec0fdaca
commit 88f091b93e

View File

@ -92,15 +92,17 @@ public class ObjRecord
{
subrecords = new ArrayList();
int pos = offset;
while (pos - offset < size)
while (pos - offset <= size-2) // atleast one "short" must be present
{
short subRecordSid = LittleEndian.getShort(data, pos);
short subRecordSize = LittleEndian.getShort(data, pos + 2);
short subRecordSize = -1; // set default to "< 0"
if (pos-offset <= size-4) { // see if size info is present, else default to -1
subRecordSize = LittleEndian.getShort(data, pos + 2);
}
Record subRecord = SubRecord.createSubRecord(subRecordSid, subRecordSize, data, pos + 4);
subrecords.add(subRecord);
pos += subRecord.getRecordSize();
}
}
public String toString()