Return-Path: X-Original-To: apmail-pdfbox-commits-archive@www.apache.org Delivered-To: apmail-pdfbox-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1DA5511CD3 for ; Tue, 13 May 2014 19:41:40 +0000 (UTC) Received: (qmail 47744 invoked by uid 500); 13 May 2014 17:54:59 -0000 Delivered-To: apmail-pdfbox-commits-archive@pdfbox.apache.org Received: (qmail 47720 invoked by uid 500); 13 May 2014 17:54:59 -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 47713 invoked by uid 99); 13 May 2014 17:54:59 -0000 Received: from Unknown (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 May 2014 17:54:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 May 2014 17:54:58 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id A196123889E2; Tue, 13 May 2014 17:54:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1594304 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java Date: Tue, 13 May 2014 17:54:38 -0000 To: commits@pdfbox.apache.org From: tilman@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140513175438.A196123889E2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tilman Date: Tue May 13 17:54:38 2014 New Revision: 1594304 URL: http://svn.apache.org/r1594304 Log: PDFBOX-2073: Be more restrictive than the PDF spec Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java?rev=1594304&r1=1594303&r2=1594304&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java Tue May 13 17:54:38 2014 @@ -587,17 +587,26 @@ public final class COSName extends COSBa { int current = (bytes[i] + 256) % 256; - if (current <= 32 || current >= 127 || current == '(' || current == ')' || current == '[' || current == ']' - || current == '/' || current == '%' || current == '<' || current == '>' - || current == '{' || current == '}' // PDFBOX-2073 - || current == NAME_ESCAPE[0]) + // Be more restrictive than the PDF spec, "Name Objects" + // see PDFBOX-2073 + if ((current >= 'A' && current <= 'Z') + || (current >= 'a' && current <= 'z') + || (current >= '0' && current <= '9') + || current == '+' + || current == '-' + || current == '_' + || current == '@' + || current == '*' + || current == '$' + || current == ';' + || current == '.') { - output.write(NAME_ESCAPE); - output.write(COSHEXTable.TABLE[current]); + output.write(current); } else { - output.write(current); + output.write(NAME_ESCAPE); + output.write(COSHEXTable.TABLE[current]); } } }