Created an attachment (id=31363)
Do not restoreState on empty stack
This PDF is horrendously malformed. As far as I can tell, several of the pages have command streams missing spaces and who knows what else. Even acroread will display an error. That said, acroread does not crash and does a much better job rendering it than we do.
The confused command stream results in a restoreState without the right number of saveStates. The above patch causes that to result in a warning.
We probably want to try being lenient about parsing the command stream to allow one to omit the spaces before/after commands? I suspect this is what acroread is doing. This may be tricky as some commands (d0 and d1) end in numbers.
Created an attachment (id=31363)
Do not restoreState on empty stack
This PDF is horrendously malformed. As far as I can tell, several of the pages have command streams missing spaces and who knows what else. Even acroread will display an error. That said, acroread does not crash and does a much better job rendering it than we do.
The confused command stream results in a restoreState without the right number of saveStates. The above patch causes that to result in a warning.
We probably want to try being lenient about parsing the command stream to allow one to omit the spaces before/after commands? I suspect this is what acroread is doing. This may be tricky as some commands (d0 and d1) end in numbers.