You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2021/02/22 17:11:34 UTC
svn commit: r1886807 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
Author: tilman
Date: Mon Feb 22 17:11:34 2021
New Revision: 1886807
URL: http://svn.apache.org/viewvc?rev=1886807&view=rev
Log:
PDFBOX-5104: avoid ArrayIndexOutOfBoundsException
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java?rev=1886807&r1=1886806&r2=1886807&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java Mon Feb 22 17:11:34 2021
@@ -560,6 +560,11 @@ public final class StandardSecurityHandl
byte[] oHash = new byte[32];
byte[] oValidationSalt = new byte[8];
+ if (owner.length < 40)
+ {
+ // PDFBOX-5104
+ throw new IOException("Owner password is too short");
+ }
System.arraycopy(owner, 0, oHash, 0, 32);
System.arraycopy(owner, 32, oValidationSalt, 0, 8);