Commit 68e0957740d853c86bf5fac10caa2f540cbf35bc

Authored by m-holger
Committed by GitHub
2 parents 466169d0 6883a9c8

Merge pull request #1352 from m-holger/fuzz

In Pl_RunLength apply memory limit before and after decoding
Showing 1 changed file with 3 additions and 0 deletions
libqpdf/Pl_RunLength.cc
@@ -156,6 +156,9 @@ Pl_RunLength::finish() @@ -156,6 +156,9 @@ Pl_RunLength::finish()
156 unsigned char ch = 128; 156 unsigned char ch = 128;
157 next()->write(&ch, 1); 157 next()->write(&ch, 1);
158 } else { 158 } else {
  159 + if (memory_limit && (m->out.size()) > memory_limit) {
  160 + throw std::runtime_error("Pl_RunLength memory limit exceeded");
  161 + }
159 next()->writeString(m->out); 162 next()->writeString(m->out);
160 } 163 }
161 next()->finish(); 164 next()->finish();