summaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFWriter.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2014-02-23 04:12:34 +0100
committerJay Berkenbilt <ejb@ql.org>2014-02-23 04:13:31 +0100
commitb0a96ce6aa95c4d23e40eed3cede2f46e935bba7 (patch)
tree6ad49dca9903b000a0b0dd6271662108b886c4d6 /libqpdf/QPDFWriter.cc
parent247d70efee7e55436f119e7fe5a067f8f6dbf03a (diff)
downloadqpdf-b0a96ce6aa95c4d23e40eed3cede2f46e935bba7.tar.zst
Fix calculation of xref stream stream columns
Fix problem: if the last object in the first part of a linearized file had an offset that was below 65536 by less than the size of the hint stream, the xref stream was invalid and the resulting file is not usable.
Diffstat (limited to 'libqpdf/QPDFWriter.cc')
-rw-r--r--libqpdf/QPDFWriter.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc
index 7dd0d54d..0f299a45 100644
--- a/libqpdf/QPDFWriter.cc
+++ b/libqpdf/QPDFWriter.cc
@@ -2447,7 +2447,7 @@ QPDFWriter::writeXRefStream(int xref_id, int max_id, qpdf_offset_t max_offset,
qpdf_offset_t space_before_zero = xref_offset - 1;
// field 1 contains offsets and object stream identifiers
- int f1_size = std::max(bytesNeeded(max_offset),
+ int f1_size = std::max(bytesNeeded(max_offset + hint_length),
bytesNeeded(max_id));
// field 2 contains object stream indices