From f6794774e8443b3d77fefe7017c60dc652519d84 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Wed, 5 Nov 2014 23:33:33 +0000 Subject: [PATCH] another blind sha2 bug fix ... git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1637005 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/poifs/crypt/dsig/SignatureInfo.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java b/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java index 8be5797d62..59d7f44d28 100644 --- a/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java +++ b/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java @@ -241,6 +241,8 @@ public class SignatureInfo implements SignatureConfigurable { } return valid; + } catch (ArrayIndexOutOfBoundsException e) { + throw new JvmBrokenException(e); } catch (Exception e) { LOG.log(POILogger.ERROR, "error in marshalling and validating the signature", e); return false; @@ -538,7 +540,7 @@ public class SignatureInfo implements SignatureConfigurable { String description = signatureConfig.getSignatureDescription(); return new DigestInfo(digestValue, signatureConfig.getDigestAlgo(), description); } catch (ArrayIndexOutOfBoundsException e) { - throw new EncryptedDocumentException("\"your JVM is just too broken\" - check https://bugzilla.redhat.com/show_bug.cgi?id=1155012 if this applies to the stacktrace ...", e); + throw new JvmBrokenException(e); } } @@ -649,4 +651,10 @@ public class SignatureInfo implements SignatureConfigurable { private static List safe(List other) { return other == null ? Collections.EMPTY_LIST : other; } + + private static class JvmBrokenException extends EncryptedDocumentException { + public JvmBrokenException(Throwable cause) { + super("\"your JVM is just too broken\" - check https://bugzilla.redhat.com/show_bug.cgi?id=1155012 if this applies to the stacktrace ...", cause); + } + } } -- 2.39.5