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 0B370200D31 for ; Sat, 4 Nov 2017 14:12:14 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 09BE5160BE7; Sat, 4 Nov 2017 13:12:14 +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 4F029160BD5 for ; Sat, 4 Nov 2017 14:12:13 +0100 (CET) Received: (qmail 71219 invoked by uid 500); 4 Nov 2017 13:12:12 -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 71210 invoked by uid 99); 4 Nov 2017 13:12:12 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Nov 2017 13:12:12 +0000 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 3F0FC3A0223 for ; Sat, 4 Nov 2017 13:12:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1814285 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java Date: Sat, 04 Nov 2017 13:12:07 -0000 To: commits@pdfbox.apache.org From: lehmi@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20171104131211.3F0FC3A0223@svn01-us-west.apache.org> archived-at: Sat, 04 Nov 2017 13:12:14 -0000 Author: lehmi Date: Sat Nov 4 13:12:07 2017 New Revision: 1814285 URL: http://svn.apache.org/viewvc?rev=1814285&view=rev Log: PDFBOX-3990: detect another possible EOF while decompressing, removed assignment Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java?rev=1814285&r1=1814284&r2=1814285&view=diff ============================================================================== --- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java (original) +++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/RunLengthDecodeFilter.java Sat Nov 4 13:12:07 2017 @@ -45,8 +45,8 @@ final class RunLengthDecodeFilter extend if (dupAmount <= 127) { int amountToCopy = dupAmount + 1; - int compressedRead = 0; - while(amountToCopy > 0) + int compressedRead; + while (amountToCopy > 0) { compressedRead = encoded.read(buffer, 0, amountToCopy); // EOF reached? @@ -61,6 +61,11 @@ final class RunLengthDecodeFilter extend else { int dupByte = encoded.read(); + // EOF reached? + if (dupByte == -1) + { + break; + } for (int i = 0; i < 257 - dupAmount; i++) { decoded.write(dupByte);