History

reduce pdfobj recursion on number parsing

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.

Sigrid Solveig Haflínudóttir committed 3 years ago

Commit dfa5b681 parent 76627818 files · +19 −13Browse files

Showing the changes to array.c (1 of 8 files). Show all

Unified · Split

array.c+1−1
@@ -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 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t