diff options
author | Jay Berkenbilt <ejb@ql.org> | 2023-01-01 04:30:51 +0100 |
---|---|---|
committer | Jay Berkenbilt <jberkenbilt@users.noreply.github.com> | 2023-01-01 13:33:34 +0100 |
commit | bf477fbb9622b85caeafc0783381de7103b281cd (patch) | |
tree | f17f044de562452b8e041a3d19b089b90b61261c /qpdf/test_driver.cc | |
parent | 2611f42c36255e3fa7aecb17aa5689b6d75eed72 (diff) | |
download | qpdf-bf477fbb9622b85caeafc0783381de7103b281cd.tar.zst |
Do double indirect test correctly
Diffstat (limited to 'qpdf/test_driver.cc')
-rw-r--r-- | qpdf/test_driver.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index 3a907464..5bae8b54 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -1245,14 +1245,13 @@ test_31(QPDF& pdf, char const* arg2) } catch (std::runtime_error const& e) { std::cout << "trailing data: " << e.what() << std::endl; } - try { - assert(QPDFObjectHandle::parse(&pdf, "5 0 R").isInteger()); - QPDFObjectHandle::parse(&pdf, "5 0 R 0 R"); - std::cout << "oops -- didn't throw" << std::endl; - } catch (std::runtime_error const& e) { - std::cout << "broken indirect object reference: " << e.what() - << std::endl; - } + assert( + QPDFObjectHandle::parse(&pdf, "[5 0 R]").getArrayItem(0).isInteger()); + // Make sure an indirect integer followed by "0 R" is not + // mistakenly parsed as an indirect object. + assert( + QPDFObjectHandle::parse(&pdf, "[5 0 R 0 R /X]").unparse() == + "[ 5 0 R 0 (R) /X ]"); assert( QPDFObjectHandle::parse(&pdf, "[1 0 R]", "indirect test").unparse() == "[ 1 0 R ]"); |