Commit 68e0957740d853c86bf5fac10caa2f540cbf35bc
Committed by
GitHub
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 | 156 | unsigned char ch = 128; |
| 157 | 157 | next()->write(&ch, 1); |
| 158 | 158 | } else { |
| 159 | + if (memory_limit && (m->out.size()) > memory_limit) { | |
| 160 | + throw std::runtime_error("Pl_RunLength memory limit exceeded"); | |
| 161 | + } | |
| 159 | 162 | next()->writeString(m->out); |
| 160 | 163 | } |
| 161 | 164 | next()->finish(); | ... | ... |