Created attachment 23126 [details] cross.pdf If I run the command line gs -q -dNODISPLAY --permit-file-read=tests/data/cross.pdf -c "(tests/data/cross.pdf) (r) file runpdfbegin 1 pdfgetpage /MediaBox pget pop == quit" I get [-0.2 -0.9 72.2 72.8] free(): double free detected in tcache 2 Aborted (core dumped) whereas gs -q -dNODISPLAY -dNOSAFER -c "(tests/data/cross.pdf) (r) file runpdfbegin 1 pdfgetpage /MediaBox pget pop == quit" has no double-free and gives: [-0.2 -0.9 72.2 72.8] Ghostscript version is 9.56.1. The problem occurs with any PDF file but I attach cross.pdf anyway.
As noted in bug report 705836; if you are going to initialise the PDF interpreter (using runpdfbegin) then you should terminate it before exit (using runpdfend). Doing so will, almost certainly, solve your problem with 9.56.1. As noted in 705836, this has been fixed in current code, you may like to try the 10.00.0 release candidate. *** This bug has been marked as a duplicate of bug 705836 ***
One additional question: The command line shown in the initial posting is from the test suite of xfig. Does such a command line still work in 10.00.0? Does it require the PostScript incarnation of the PDF interpreter?
(In reply to Till Kamppeter from comment #2) > The command line shown in the initial posting is from the test suite of > xfig. Does such a command line still work in 10.00.0? Does it require the > PostScript incarnation of the PDF interpreter? Since it is running PostScript yes, obviously, it requires the PostScript interpreter. Can you get the MediaBox without using the PostScript interpreter ? Yes, you can use the -dPDFINFO switch. This works with both Ghostscript and GhostPDF and is documented in the 10.00.0 release. It does not produce the information in the same format as your original PostScript program. If you require that specific format then you're going to have to script the interpreter which mean writing a program, which means using PostScript and therefore the PostScript interpreter.