Hi,

Some PDFs contain strange values in trailer/ID, for example:

trailer
<</Size 17/Info 15 0 R/Root 16 0 R/ID[<><>]>>

startxref
78443
%%EOF

PdfStamperImpl has ArrayIndexOutOfBounds in the case above. Patch below
fixes the issue:

diff -ru originals/com/itextpdf/text/pdf/PdfEncryption.java
itextpdf-5.4.2-sources/com/itextpdf/text/pdf/PdfEncryption.java
--- originals/com/itextpdf/text/pdf/PdfEncryption.java  2013-05-31
12:30:32.000000000 +0300
+++ itextpdf-5.4.2-sources/com/itextpdf/text/pdf/PdfEncryption.java
2013-08-27 13:41:14.000000000 +0300
@@ -554,11 +554,11 @@
        public static PdfObject createInfoId(byte id[]) {
                ByteBuffer buf = new ByteBuffer(90);
                buf.append('[').append('<');
-               for (int k = 0; k < 16; ++k)
+               for (int k = 0; k < id.length; ++k)
                        buf.appendHex(id[k]);
                buf.append('>').append('<');
                id = createDocumentId();
-               for (int k = 0; k < 16; ++k)
+               for (int k = 0; k < id.length; ++k)
                        buf.appendHex(id[k]);
                buf.append('>').append(']');
                return new PdfLiteral(buf.toByteArray());

-- 
Ivan



------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to