Cairo 1.18.2 regression when writing PDFs with fonts
Since version 1.18.2, some PDF files can no more be written out. After calling cairo_surface_finish()
on some PDF surfaces, cairo_surface_status()
returns CAIRO_STATUS_NO_MEMORY
"out of memory". The issue arises when simply rendering a PDF from poppler to a cairo PDF surface. The problematic element seems to be the fonts.
I have bisected the issue and found that commit 212f4589 seems to be the one that introduced the bug.
Minimal reproducible example: main.cpp, similar to https://www.cairographics.org/cookbook/renderpdf/
img-with-fonts.pdf will trigger the error, while img-NO-fonts.pdf will not. minimal.tex compiled with lualatex or xelatex will trigger the error, while when compiled with pdflatex, it works fine. Also, the issue does not arise with PostScript surfaces (simply replace all occurences of "pdf" with "ps").
The original issue was submitted downstream here.