You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2020/05/17 16:24:20 UTC
svn commit: r1877865 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
Author: lehmi
Date: Sun May 17 16:24:20 2020
New Revision: 1877865
URL: http://svn.apache.org/viewvc?rev=1877865&view=rev
Log:
PDFBOX-4071: ensure that all needed bytes are read
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java?rev=1877865&r1=1877864&r2=1877865&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java Sun May 17 16:24:20 2020
@@ -363,7 +363,7 @@ public abstract class SecurityHandler
if (decrypt)
{
// read IV from stream
- int ivSize = data.read(iv);
+ int ivSize = (int) IOUtils.populateBuffer(data, iv);
if (ivSize == -1)
{
return false;
@@ -461,7 +461,7 @@ public abstract class SecurityHandler
// PDFBOX-3229 check case where metadata is not encrypted despite /EncryptMetadata missing
InputStream is = stream.createRawInputStream();
byte buf[] = new byte[10];
- is.read(buf);
+ IOUtils.populateBuffer(is, buf);
is.close();
if (Arrays.equals(buf, "<?xpacket ".getBytes(Charsets.ISO_8859_1)))
{