aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2010-08-13 19:02:48 +0000
committerJeremias Maerki <jeremias@apache.org>2010-08-13 19:02:48 +0000
commitad93316e324520818ebfd4f4e02644f681c31812 (patch)
tree4ef5d91fdf7e8d42b37c50d66743e7a5445569c2 /src/java
parentb494dac09e1d68250227cb2bd947e655081f145c (diff)
downloadxmlgraphics-fop-ad93316e324520818ebfd4f4e02644f681c31812.tar.gz
xmlgraphics-fop-ad93316e324520818ebfd4f4e02644f681c31812.zip
Bugfix for StringIndexOutOfBoundsException when the PDF grows beyond 2GB.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Color@985323 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/pdf/PDFDocument.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFDocument.java b/src/java/org/apache/fop/pdf/PDFDocument.java
index f0a777bdd..10834760e 100644
--- a/src/java/org/apache/fop/pdf/PDFDocument.java
+++ b/src/java/org/apache/fop/pdf/PDFDocument.java
@@ -67,7 +67,7 @@ import org.apache.commons.logging.LogFactory;
*/
public class PDFDocument {
- private static final Integer LOCATION_PLACEHOLDER = new Integer(0);
+ private static final Long LOCATION_PLACEHOLDER = new Long(0);
/** Integer constant to represent PDF 1.3 */
public static final int PDF_VERSION_1_3 = 3;
@@ -85,10 +85,10 @@ public class PDFDocument {
private Log log = LogFactory.getLog("org.apache.fop.pdf");
/** the current character position */
- private int position = 0;
+ private long position = 0;
/** character position of xref table */
- private int xref;
+ private long xref;
/** the character position of each object */
private List location = new ArrayList();
@@ -911,11 +911,11 @@ public class PDFDocument {
* @param objidx the object's index
* @param position the position
*/
- private void setLocation(int objidx, int position) {
+ private void setLocation(int objidx, long position) {
while (this.location.size() <= objidx) {
this.location.add(LOCATION_PLACEHOLDER);
}
- this.location.set(objidx, new Integer(position));
+ this.location.set(objidx, new Long(position));
}
/**
@@ -1019,7 +1019,7 @@ public class PDFDocument {
PDFObject o = (PDFObject)this.trailerObjects.get(count);
this.location.set(
o.getObjectNumber() - 1,
- new Integer(this.position));
+ new Long(this.position));
this.position += o.output(stream);
}
/* output the xref table and increment the character position
@@ -1073,6 +1073,9 @@ public class PDFDocument {
for (int count = 0; count < this.location.size(); count++) {
final String padding = "0000000000";
s = this.location.get(count).toString();
+ if (s.length() > 10) {
+ throw new IOException("PDF file too large. PDF cannot grow beyond approx. 9.3GB.");
+ }
/* contruct xref entry for object */
loc = padding.substring(s.length()) + s;