Since only the next object needs to be looked ahead (it has to be a number) we should not recurse further because otherwise parsing integer-only arrays is going to be rather slow and most likely produce a stack overflow. Add an explicit "flags" to pdfobj function, with Norecurse set when looking ahead.
Showing the changes to array.c (1 of 8 files). Show all
Unified · Split
| @@ -24,7 +24,7 @@ pdfarray(Pdf *pdf, Stream *s) · 23 unmodified lines | |||
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | Sungetc(s); | 26 | Sungetc(s); |
| 27 | if((m = pdfobj(pdf, s)) == nil){ | 27 | if((m = pdfobj(pdf, s, 0)) == nil){ |
| 28 | noel = 1; | 28 | noel = 1; |
| 29 | continue; | 29 | continue; |
| 30 | } | 30 | } |