Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C00D9200BC0 for ; Tue, 15 Nov 2016 18:59:09 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id BEC7C160B03; Tue, 15 Nov 2016 17:59:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 15982160AF2 for ; Tue, 15 Nov 2016 18:59:08 +0100 (CET) Received: (qmail 53212 invoked by uid 500); 15 Nov 2016 17:59:08 -0000 Mailing-List: contact commits-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list commits@pdfbox.apache.org Received: (qmail 53203 invoked by uid 99); 15 Nov 2016 17:59:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Nov 2016 17:59:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id E318C1A938F for ; Tue, 15 Nov 2016 17:59:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 2H1hkQA32w_n for ; Tue, 15 Nov 2016 17:59:07 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 0EBB55F4E7 for ; Tue, 15 Nov 2016 17:59:07 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 34C0AE0054 for ; Tue, 15 Nov 2016 17:59:04 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id E6F043A1AB1 for ; Tue, 15 Nov 2016 17:59:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1769864 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java Date: Tue, 15 Nov 2016 17:59:03 -0000 To: commits@pdfbox.apache.org From: tilman@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161115175903.E6F043A1AB1@svn01-us-west.apache.org> archived-at: Tue, 15 Nov 2016 17:59:09 -0000 Author: tilman Date: Tue Nov 15 17:59:03 2016 New Revision: 1769864 URL: http://svn.apache.org/viewvc?rev=1769864&view=rev Log: PDFBOX-3572: avoid NPE due to BC sometimes returning null instead of an empty array Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java?rev=1769864&r1=1769863&r2=1769864&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java Tue Nov 15 17:59:03 2016 @@ -267,7 +267,11 @@ public abstract class SecurityHandler int n; while ((n = data.read(buffer)) != -1) { - output.write(decryptCipher.update(buffer, 0, n)); + byte[] dst = decryptCipher.update(buffer, 0, n); + if (dst != null) + { + output.write(dst); + } } output.write(decryptCipher.doFinal()); }