pdftocairo handles errors in Type 3 fonts badly
We've encountered some PDFs with a broken Type 3 font - specifically, one /CharProcs entry doesn't point to a stream but inexplicably points back to the page object. Currently, this makes pdftocairo fail to render not only the page but all subsequent pages too. The problem appears to be that when _render_type3_glyph returns CAIRO_STATUS_USER_FONT_ERROR, the cairo surface is set to an error status and this is never cleared (and it doesn't appear there is any way to clear it). Other PDF renderers are able to handle this error condition more gracefully, omitting only the character or at most the font, with the remainder of the document showing up fine.
While testing this, I also found another pdftocairo bug: if a character isn't in /CharProcs at all, then pdftocairo displays it as the first /CharProcs entry (because CairoType3Font::create initializes the codeToGID array to 0). All other programs I tested will display it as a space or nothing.
Attached is a test .pdf file and a patch to fix both bugs. type3test.pdf type3errors.patch