aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/bound-checks.test
blob: 46f8637dd2df605cd4b681193862f0976ecf1b3e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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);