Segmentation fault in cairo_surface_status
I run into this problem using pdftocairo (poppler) on an ubuntu 18.04 server, then recompiled poppler (0.79) and cairo (1.16.0 commit 3ad43122).
I get a segmentation fault when trying to convert a PDF file into a pdf file with the command:
./pdftocairo input.pdf -pdf -o output.pdf
Here is the valgrind report:
$ valgrind ./pdftocairo ./input.pdf -pdf -o output.pdf
==16389== Memcheck, a memory error detector
==16389== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==16389== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==16389== Command: ./pdftocairo ./input.pdf -pdf -o output.pdf
==16389==
==16389== Invalid read of size 4
==16389== at 0x4EB0D40: cairo_surface_status (cairo-surface.c:260)
==16389== by 0x1180EF: endDocument (pdftocairo.cc:785)
==16389== by 0x1180EF: main (pdftocairo.cc:1260)
==16389== Address 0x1c is not stack'd, malloc'd or (recently) free'd
==16389==
==16389==
==16389== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==16389== Access not within mapped region at address 0x1C
==16389== at 0x4EB0D40: cairo_surface_status (cairo-surface.c:260)
==16389== by 0x1180EF: endDocument (pdftocairo.cc:785)
==16389== by 0x1180EF: main (pdftocairo.cc:1260)
==16389== If you believe this happened as a result of a stack
==16389== overflow in your program's main thread (unlikely but
==16389== possible), you can try to increase the size of the
==16389== main thread stack using the --main-stacksize= flag.
==16389== The main thread stack size used in this run was 8388608.
==16389==
==16389== HEAP SUMMARY:
==16389== in use at exit: 427,599 bytes in 4,784 blocks
==16389== total heap usage: 5,070 allocs, 286 frees, 790,648 bytes allocated
==16389==
==16389== LEAK SUMMARY:
==16389== definitely lost: 536 bytes in 1 blocks
==16389== indirectly lost: 568 bytes in 1 blocks
==16389== possibly lost: 0 bytes in 0 blocks
==16389== still reachable: 426,495 bytes in 4,782 blocks
==16389== suppressed: 0 bytes in 0 blocks
==16389== Rerun with --leak-check=full to see details of leaked memory
==16389==
==16389== For counts of detected and suppressed errors, rerun with: -v
==16389== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)