mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-23 03:18:59 +00:00
Protect against future bugs in fixCopiedAnnotations
I don't want additional, undiscovered bugs to fully block page splitting/merging operations.
This commit is contained in:
parent
85884c363c
commit
972e08af58
30
qpdf/qpdf.cc
30
qpdf/qpdf.cc
@ -5946,9 +5946,20 @@ static void handle_page_specs(QPDF& pdf, Options& o, bool& warnings)
|
|||||||
{
|
{
|
||||||
QTC::TC("qpdf", "qpdf copy fields non-first from orig");
|
QTC::TC("qpdf", "qpdf copy fields non-first from orig");
|
||||||
}
|
}
|
||||||
this_afdh->fixCopiedAnnotations(
|
try
|
||||||
new_page, to_copy.getObjectHandle(), *other_afdh,
|
{
|
||||||
&referenced_fields);
|
this_afdh->fixCopiedAnnotations(
|
||||||
|
new_page, to_copy.getObjectHandle(), *other_afdh,
|
||||||
|
&referenced_fields);
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
pdf.warn(
|
||||||
|
QPDFExc(qpdf_e_damaged_pdf, pdf.getFilename(),
|
||||||
|
"", 0, "Exception caught while fixing copied"
|
||||||
|
" annotations. This may be a qpdf bug." +
|
||||||
|
std::string("Exception: ") + e.what()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (page_data.qpdf->anyWarnings())
|
if (page_data.qpdf->anyWarnings())
|
||||||
@ -6400,7 +6411,18 @@ static void do_split_pages(QPDF& pdf, Options& o, bool& warnings)
|
|||||||
if (out_afdh.getPointer())
|
if (out_afdh.getPointer())
|
||||||
{
|
{
|
||||||
QTC::TC("qpdf", "qpdf copy form fields in split_pages");
|
QTC::TC("qpdf", "qpdf copy form fields in split_pages");
|
||||||
out_afdh->fixCopiedAnnotations(new_page, page, afdh);
|
try
|
||||||
|
{
|
||||||
|
out_afdh->fixCopiedAnnotations(new_page, page, afdh);
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
pdf.warn(
|
||||||
|
QPDFExc(qpdf_e_damaged_pdf, pdf.getFilename(),
|
||||||
|
"", 0, "Exception caught while fixing copied"
|
||||||
|
" annotations. This may be a qpdf bug." +
|
||||||
|
std::string("Exception: ") + e.what()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pldh.hasPageLabels())
|
if (pldh.hasPageLabels())
|
||||||
|
Loading…
Reference in New Issue
Block a user