Skip to content

Commit

Permalink
Change default for SF_FlateLzwDecode::columns to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
m-holger committed Nov 23, 2023
1 parent 81823f4 commit 9146f1f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libqpdf/SF_FlateLzwDecode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SF_FlateLzwDecode::SF_FlateLzwDecode(bool lzw) :
lzw(lzw),
// Initialize values to their defaults as per the PDF spec
predictor(1),
columns(0),
columns(1),
colors(1),
bits_per_component(8),
early_code_change(true)
Expand Down
Binary file added qpdf/qtest/qpdf/png-filters-1-column.pdf
Binary file not shown.
Binary file not shown.
Binary file added qpdf/qtest/qpdf/png-filters-no-columns.pdf
Binary file not shown.
16 changes: 14 additions & 2 deletions qpdf/qtest/specialized-filter.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cleanup();

my $td = new TestDriver('specialized-filter');

my $n_tests = 3;
my $n_tests = 5;
my $n_compare_pdfs = 1;

# The PDF file was submitted on bug #83 on github. All the PNG filters
Expand All @@ -39,6 +39,18 @@ $td->runtest("stream with tiff predictor",
{$td->FILE => "tiff-predictor.out",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);

# TC:SF_FlateLzwDecode PNG filter
# PDF:Table 8:Columns
# The test file is invalid as it does not actually use one column (as is implied by the missing
# key). However png-filters-1-column.pdf is the same file with /Columns explicitely set to 1,
# and displays the same as png-filters-no-columns.pdf and png-filters-no-columns-decoded.pdf.
$td->runtest("decode flate no /Columns",
{$td->COMMAND => "qpdf --static-id --compress-streams=n --decode-level=all" .
" png-filters-no-columns.pdf a.pdf"},
{$td->STRING => "", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("check output",
{$td->FILE => "a.pdf"},
{$td->FILE => "png-filters-no-columns-decoded.pdf"});
cleanup();
$td->report(calc_ntests($n_tests, $n_compare_pdfs));

0 comments on commit 9146f1f

Please sign in to comment.