diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hemf/usermodel/HemfPicture.java b/poi-scratchpad/src/main/java/org/apache/poi/hemf/usermodel/HemfPicture.java index ffd51c65c4..95d73082b8 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hemf/usermodel/HemfPicture.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hemf/usermodel/HemfPicture.java @@ -81,6 +81,8 @@ public class HemfPicture implements Iterable, GenericRecord { List r = getRecords(); if (r.isEmpty()) { throw new RecordFormatException("No records could be parsed - your .emf file is invalid"); + } else if (!(r.get(0) instanceof HemfHeader)) { + throw new RecordFormatException("Could not convert object of type " + r.get(0).getClass() + " + - your .emf file is invalid"); } else { return (HemfHeader)r.get(0); } diff --git a/test-data/slideshow/VHZ2NYFUYUUJNGLABL26ORTQZA76FJEW.emf b/test-data/slideshow/VHZ2NYFUYUUJNGLABL26ORTQZA76FJEW.emf new file mode 100755 index 0000000000..6dac267f33 Binary files /dev/null and b/test-data/slideshow/VHZ2NYFUYUUJNGLABL26ORTQZA76FJEW.emf differ diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls index b0f95e64b3..aec4cdf62e 100644 Binary files a/test-data/spreadsheet/stress.xls and b/test-data/spreadsheet/stress.xls differ