aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/bound_checks.test
diff options
context:
space:
mode:
Diffstat (limited to 'qpdf/qtest/bound_checks.test')
-rw-r--r--qpdf/qtest/bound_checks.test38
1 files changed, 38 insertions, 0 deletions
diff --git a/qpdf/qtest/bound_checks.test b/qpdf/qtest/bound_checks.test
new file mode 100644
index 00000000..50cef2c5
--- /dev/null
+++ b/qpdf/qtest/bound_checks.test
@@ -0,0 +1,38 @@
+#!/usr/bin/env perl
+require 5.008;
+use warnings;
+use strict;
+
+unshift(@INC, '.');
+require qpdf_test_helpers;
+
+chdir("qpdf") or die "chdir testdir failed: $!\n";
+
+require TestDriver;
+
+cleanup();
+
+my $td = new TestDriver('bound_checks');
+
+my $n_tests = 3;
+
+$td->runtest("bounds check linearization data 1",
+ {$td->COMMAND => "qpdf --check linearization-bounds-1.pdf"},
+ {$td->FILE => "linearization-bounds-1.out",
+ $td->EXIT_STATUS => 3},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("bounds check linearization data 2",
+ {$td->COMMAND => "qpdf --check linearization-bounds-2.pdf"},
+ {$td->FILE => "linearization-bounds-2.out",
+ $td->EXIT_STATUS => 3},
+ $td->NORMALIZE_NEWLINES);
+# Throws runtime error, not bad_alloc
+$td->runtest("sanity check array size",
+ {$td->COMMAND =>
+ "qpdf --check linearization-large-vector-alloc.pdf"},
+ {$td->FILE => "linearization-large-vector-alloc.out",
+ $td->EXIT_STATUS => 3},
+ $td->NORMALIZE_NEWLINES);
+
+cleanup();
+$td->report($n_tests);