mirror of https://github.com/apache/poi.git
Consistency check added when reading property set stream. An IllegalPropertyDataException is thrown if the property set stream is larger than it claims to be.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@550021 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
84726d7ca1
commit
ce9f8ceb88
|
@ -244,6 +244,16 @@ public class Section
|
||||||
{
|
{
|
||||||
ple = (PropertyListEntry) propertyList.get(propertyCount - 1);
|
ple = (PropertyListEntry) propertyList.get(propertyCount - 1);
|
||||||
ple.length = size - ple.offset;
|
ple.length = size - ple.offset;
|
||||||
|
if (ple.length <= 0)
|
||||||
|
{
|
||||||
|
final StringBuffer b = new StringBuffer();
|
||||||
|
b.append("The property set claims to have a size of ");
|
||||||
|
b.append(size);
|
||||||
|
b.append(" bytes. However, it exceeds ");
|
||||||
|
b.append(ple.offset);
|
||||||
|
b.append(" bytes.");
|
||||||
|
throw new IllegalPropertySetDataException(b.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look for the codepage. */
|
/* Look for the codepage. */
|
||||||
|
@ -323,6 +333,20 @@ public class Section
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
final StringBuffer b = new StringBuffer();
|
||||||
|
b.append(getClass().getName());
|
||||||
|
b.append("[id=");
|
||||||
|
b.append(id);
|
||||||
|
b.append(", offset=");
|
||||||
|
b.append(offset);
|
||||||
|
b.append(", length=");
|
||||||
|
b.append(length);
|
||||||
|
b.append(']');
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue