Commit ac42965052d783fd5cfeb8b22809f66e4490fc50

Authored by m-holger
Committed by GitHub
2 parents 0e9b9dab 0eb29c73

Merge pull request #1265 from m-holger/fuzz

If Pl_Flate memory limit is exceeded do not attempt 'finish' processing
Showing 1 changed file with 3 additions and 0 deletions
libqpdf/Pl_Flate.cc
@@ -204,6 +204,9 @@ Pl_Flate::handleData(unsigned char const* data, size_t len, int flush) @@ -204,6 +204,9 @@ Pl_Flate::handleData(unsigned char const* data, size_t len, int flush)
204 void 204 void
205 Pl_Flate::finish() 205 Pl_Flate::finish()
206 { 206 {
  207 + if (m->written > memory_limit) {
  208 + return;
  209 + }
207 try { 210 try {
208 if (m->outbuf.get()) { 211 if (m->outbuf.get()) {
209 if (m->initialized) { 212 if (m->initialized) {