Commit 742190bd98c0981a07cb39a8eae1e99d909ad5ae

Authored by Jay Berkenbilt
1 parent 6d46346e

Pl_PNGFilter: disallow columns = 0

Showing 1 changed file with 4 additions and 0 deletions
libqpdf/Pl_PNGFilter.cc
@@ -14,6 +14,10 @@ Pl_PNGFilter::Pl_PNGFilter(char const* identifier, Pipeline* next, @@ -14,6 +14,10 @@ Pl_PNGFilter::Pl_PNGFilter(char const* identifier, Pipeline* next,
14 buf2(0), 14 buf2(0),
15 pos(0) 15 pos(0)
16 { 16 {
  17 + if (columns == 0)
  18 + {
  19 + throw std::runtime_error("PNGFilter created with columns = 0");
  20 + }
17 this->buf1 = new unsigned char[columns + 1]; 21 this->buf1 = new unsigned char[columns + 1];
18 this->buf2 = new unsigned char[columns + 1]; 22 this->buf2 = new unsigned char[columns + 1];
19 this->cur_row = buf1; 23 this->cur_row = buf1;