bound-checks.test 1.1 KB
#!/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);