| <<<Back 1 day (to 2022/06/26) | Fwd 1 day (to 2022/06/28) >>> | 20220627 |
artifexirc-bot | <Till Kamppeter> I want to prepare the CUPS Raster output device for the future without PPD files (CUPS 3.x). Not having PPD files requires to provide more parameters by the command line. So I am trying the following: | 16:57.50 |
| <Till Kamppeter> In `cups/gdevcups.c` in the function `cups_get_params()` I add in the end, right before the `done:` label (should be line 1117, the following: | 17:01.35 |
| <Till Kamppeter> ``` | 17:01.36 |
| <Till Kamppeter> if ((code = param_write_int(plist, "cupsRasterVersion", | 17:01.37 |
| <Till Kamppeter> (int *)&(cups->cupsRasterVersion))) < 0) | 17:01.38 |
| <Till Kamppeter> goto done; | 17:01.40 |
| <Till Kamppeter> ``` | 17:01.41 |
| <Till Kamppeter> Recompiling and executing Ghostscript again, I get a double-free in the end. | 17:01.42 |
| <Till Kamppeter> The code addition serves for reading `cupsRasterVersion` from the command line, by the way (`-dcupsRasterVersion=2`). | 17:02.32 |
| <Till Kamppeter> `cups->cupsRasterVersion` already exists in the data structure and is actually integer (line 315). | 17:04.33 |
| <Till Kamppeter> The command line I use for testing is | 17:08.58 |
| <Till Kamppeter> ``` | 17:08.59 |
| <Till Kamppeter> $ cat CityMap.pdf | gs -dQUIET -dSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE -dNOMEDIAATTRS -dUsePDFX3Profile -sstdout=%stderr -sOutputFile=%stdout -sDEVICE=cups -sMediaType=Automatic -sOutputType=0 -r600x600 -dMediaPosition=7 -dDEVICEWIDTHPOINTS=612 -dDEVICEHEIGHTPOINTS=792 -dcupsMediaType=-1 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=17 -dcupsInteger0=2 -scupsPageSizeName=Letter -I/usr/share/cups/font | 17:09.00 |
| <Till Kamppeter> ``` | 17:09.02 |
| <Till Kamppeter> and the `err` file contains after its execution: | 17:09.03 |
| <Till Kamppeter> ``` | 17:09.04 |
| <Till Kamppeter> INFO: Start rendering... | 17:09.06 |
| <Till Kamppeter> INFO: Processing page 1... | 17:09.07 |
| <Till Kamppeter> INFO: Processing page 2... | 17:09.08 |
| <Till Kamppeter> Error: /rangecheck in .installpagedevice | 17:09.09 |
| <Till Kamppeter> Operand stack: | 17:09.11 |
| <Till Kamppeter> (/tmp/gs_eduPgW) --nostringval-- --dict:172/181(ro)(L)-- --nostringval-- --nostringval-- false | 17:09.12 |
| <Till Kamppeter> Execution stack: | 17:09.13 |
| <Till Kamppeter> %interp_exit .runexec2 --nostringval-- runpdf --nostringval-- 2 %stopped_push --nostringval-- runpdf runpdf false 1 %stopped_push 1990 1 3 %oparray_pop 1989 1 3 %oparray_pop 1977 1 3 %oparray_pop runpdf 1978 3 3 %oparray_pop runpdf runpdf 2 1 1 runpdf %for_pos_int_continue runpdf | 17:09.15 |
| <Till Kamppeter> Dictionary stack: | 17:09.16 |
| <Till Kamppeter> --dict:778/1123(ro)(G)-- --dict:0/20(G)-- --dict:76/200(L)-- --dict:18/20(L)-- | 17:09.17 |
| <Till Kamppeter> Current allocation mode is local | 17:09.19 |
| <Till Kamppeter> GPL Ghostscript 9.56.1: Unrecoverable error, exit code 1 | 17:09.20 |
| <Till Kamppeter> INFO: Rendering completed | 17:09.21 |
| <Till Kamppeter> free(): double free detected in tcache 2 | 17:09.22 |
| <Till Kamppeter> ``` | 17:09.24 |
| <Till Kamppeter> What is wrong with my addition? | 17:09.25 |
| <Till Kamppeter> More strange it gets if I add `-dcupsRasterVersion=2` to the command line above, the `err` file gives | 17:11.36 |
| <Till Kamppeter> ``` | 17:11.37 |
| <Till Kamppeter> Unrecoverable error: undefined in .putdeviceprops | 17:11.39 |
| <Till Kamppeter> ``` | 17:11.40 |
| <Till Kamppeter> then and there is no double-free crash. | 17:11.41 |
| <Till Kamppeter> Also, why do I get a PostScript error message with the input file being PDF and the PDF interpreter written in C? | 17:44.11 |
| <Till Kamppeter> The problem always happens in the beginning of the second page, independent how many pages the input PDF file has. An | 19:01.57 |
| <Till Kamppeter> The first page is correctly generated and written into the output file. And if the input file has only one page, a second page is prepared before the lack of further input data gets discovered and so we have also the crash. | 19:03.30 |
| <<<Back 1 day (to 2022/06/26) | Forward 1 day (to 2022/06/28)>>> | |