mirror of
https://github.com/apache/poi.git
synced 2026-02-27 12:30:08 +08:00
Avoid NPE with malformed wmf headers
This commit is contained in:
parent
692caf0f36
commit
bc02ef0703
@ -511,8 +511,18 @@ public class HwmfMisc {
|
||||
|
||||
@Override
|
||||
public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {
|
||||
style = HwmfBrushStyle.valueOf(leis.readUShort());
|
||||
colorUsage = ColorUsage.valueOf(leis.readUShort());
|
||||
int brushStyle = leis.readUShort();
|
||||
style = HwmfBrushStyle.valueOf(brushStyle);
|
||||
if (style == null) {
|
||||
throw new IllegalArgumentException("Could not read brush-style " + brushStyle);
|
||||
}
|
||||
|
||||
int colorUsageEnum = leis.readUShort();
|
||||
colorUsage = ColorUsage.valueOf(colorUsageEnum);
|
||||
if (colorUsage == null) {
|
||||
throw new IllegalArgumentException("Could not read color-usage " + colorUsage);
|
||||
}
|
||||
|
||||
int size = 2*LittleEndianConsts.SHORT_SIZE;
|
||||
switch (style) {
|
||||
case BS_SOLID:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user