diff options
author | PJ Fanning <fanningpj@apache.org> | 2022-02-19 11:28:50 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2022-02-19 11:28:50 +0000 |
commit | 6622d9badb3590cb6190d912730548635a359dc0 (patch) | |
tree | ad518dca3fb02745665f89f43ef7cdbbe9bb9d8e /poi-scratchpad/src/test | |
parent | c1b073625abf00e15598fead9b11d9a126d75311 (diff) | |
download | poi-6622d9badb3590cb6190d912730548635a359dc0.tar.gz poi-6622d9badb3590cb6190d912730548635a359dc0.zip |
[bug-65899] fix issue where malformed tnef file can cause memory problems
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898208 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-scratchpad/src/test')
-rw-r--r-- | poi-scratchpad/src/test/java/org/apache/poi/hmef/attribute/TestTNEFAttributes.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hmef/attribute/TestTNEFAttributes.java b/poi-scratchpad/src/test/java/org/apache/poi/hmef/attribute/TestTNEFAttributes.java index 9e30526999..7d8869988e 100644 --- a/poi-scratchpad/src/test/java/org/apache/poi/hmef/attribute/TestTNEFAttributes.java +++ b/poi-scratchpad/src/test/java/org/apache/poi/hmef/attribute/TestTNEFAttributes.java @@ -19,8 +19,10 @@ package org.apache.poi.hmef.attribute; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayInputStream; +import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.text.DateFormat; @@ -48,6 +50,17 @@ public final class TestTNEFAttributes { } /** + * Test malformed TNEF is detected by MAPIAttribute and does not cause Out Of Memory error + */ + @Test + void testMalformedTNEF() throws Exception { + try (InputStream is = _samples.openResourceAsStream("oom.tnef")) { + quick = new HMEFMessage(is); + } catch (Exception e) { + assertTrue(e instanceof IOException); + } + } + /** * Test counts */ @Test |