mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-08 17:24:06 +00:00
Add test case for broken indirect object reference
...where the first "number" is an indirect object that happens to be a number.
This commit is contained in:
parent
234e323743
commit
ce8e63cb9a
@ -17,7 +17,7 @@ my $td = new TestDriver('parsing');
|
||||
my $n_tests = 17;
|
||||
|
||||
$td->runtest("parse objects from string",
|
||||
{$td->COMMAND => "test_driver 31 minimal.pdf"}, # file not used
|
||||
{$td->COMMAND => "test_driver 31 good1.qdf"},
|
||||
{$td->FILE => "parse-object.out", $td->EXIT_STATUS => 0},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
$td->runtest("EOF terminating literal tokens",
|
||||
|
@ -1,4 +1,5 @@
|
||||
[ /name 16059 3.14159 false << /key true /other [ (string1) (string2) ] >> null ]
|
||||
logic error parsing indirect: QPDFObjectHandle::parse called without context on an object with indirect references
|
||||
trailing data: parsed object (trailing test): trailing data found parsing object from string
|
||||
broken indirect object reference: parsed object: trailing data found parsing object from string
|
||||
test 31 done
|
||||
|
@ -1228,8 +1228,6 @@ test_30(QPDF& pdf, char const* arg2)
|
||||
static void
|
||||
test_31(QPDF& pdf, char const* arg2)
|
||||
{
|
||||
// Test object parsing from a string. The input file is not used.
|
||||
|
||||
auto o1 = "[/name 16059 3.14159 false\n"
|
||||
" << /key true /other [ (string1) (string2) ] >> null]"_qpdf;
|
||||
std::cout << o1.unparse() << std::endl;
|
||||
@ -1247,6 +1245,14 @@ 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, "[1 0 R]", "indirect test").unparse() ==
|
||||
"[ 1 0 R ]");
|
||||
|
Loading…
Reference in New Issue
Block a user