Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ghostscript: update to 10.01.0 #18139

Closed
wants to merge 1 commit into from
Closed

Conversation

remkos
Copy link
Contributor

@remkos remkos commented Mar 30, 2023

Description

Update to upstream version 10.01.0.

From the developers: This release officially deprecates the old Postscript implementation of PDF. The option to use the old PDF implementation will be removed in the next full release (10.01.0).

This also removes an unused patch file.

In addition, a revision bump for xfig is included to make sure this new version of the library is linked.

Type(s)
  • bugfix
  • enhancement
  • security fix
Tested on

macOS 13.4.1 22F770820d x86_64
Command Line Tools 14.3.1.0.1.1683849156

Verification

Have you

  • followed our Commit Message Guidelines?
  • squashed and minimized your commits?
  • checked that there aren't other open pull requests for the same change?
  • referenced existing tickets on Trac with full URL?
  • checked your Portfile with port lint --nitpick?
  • tried existing tests with sudo port test?
  • tried a full install with sudo port -vst install?
  • tested basic functionality of all binary files?
  • checked that the Portfile's most important variants haven't been broken?

@tomio-arisaka
Copy link
Contributor

Ghostscript 10.01.1 is released.

From the developers: This release officially deprecates the old Postscript implementation of PDF. The option to use the old PDF implementation will be removed in the next full release (10.01.0).

On Ghostscript 10.01.1, -dNEWPDF=false is removed, but the PDF interpreter written in PostScript is still available. You can see it if you check the differences between Ghostscript 10.00.0 and 10.01.1.

Besides, I read some serious bug reports on the 10.01.0 release, not on 10.0.0.

What is the serious bug?
Is it a vulnerability shown on the next web page?
https://nvd.nist.gov/vuln/detail/CVE-2023-28879
If so, it is fixed on Ghostscript 10.01.1.
https://git.ghostscript.com/?p=ghostpdl.git;a=shortlog;h=refs/heads/gs10.01.1

@remkos
Copy link
Contributor Author

remkos commented Apr 26, 2023

I read of issues of rendering certain PS into PNG images, seemingly totally uncorrelated to the PDF interpreter.
Here is the reference: GenericMappingTools/gmt#7336

@tomio-arisaka
Copy link
Contributor

I read of issues of rendering certain PS into PNG images, seemingly totally uncorrelated to the PDF interpreter. Here is the reference: GenericMappingTools/gmt#7336

Thanks for the info.

I have not ever used GMT.
But I think the issue occurs due to using pngalpha or x11alpha.
('alpha' means that the background is transparent)
For example, GMT uses the pngalpha device as follows:

$ git clone https://github.com/GenericMappingTools/gmt.git gmt-code
Cloning into 'gmt-code'...
remote: Enumerating objects: 279730, done.
remote: Counting objects: 100% (1256/1256), done.
remote: Compressing objects: 100% (594/594), done.
remote: Total 279730 (delta 765), reused 1082 (delta 654), pack-reused 278474
Receiving objects: 100% (279730/279730), 875.04 MiB | 10.22 MiB/s, done.
Resolving deltas: 100% (208976/208976), done.
$ 
$ find ./gmt-code -type f -exec grep 'pngalpha' {} +
./gmt-code/admin/gs_check.sh:  -sDEVICE=pngalpha  -g2550x3300 -r300 -sOutputFile='PS_orig_for_gs.png' 'PS_orig_for_gs_intermediate.pdf'
./gmt-code/src/psconvert.c:	char *device[N_GS_DEVICES] = {"", "pdfwrite", "svg", "jpeg", "png16m", "ppmraw", "tiff24nc", "bmp16m", "pngalpha",
./gmt-code/src/psconvert.c:		"", /* pngalpha */
$ 

So I made a patch to resolve the issue of Ghostscript-10.01.1.

--- A/base/gspaint.c	2023-03-27 15:49:35.000000000 +0900
+++ B/base/gspaint.c	2023-04-27 19:13:03.000000000 +0900
@@ -208,6 +208,7 @@
     gs_fixed_rect bbox;
     gs_int_rect ibox;
     uint width, raster, band_space;
+    uint dev_width, dev_height;
     uint height, height2;
     gs_log2_scale_point log2_scale;
     gs_memory_t *mem;
@@ -223,6 +224,7 @@
     if ((ibox.q.y <= ibox.p.y) || (ibox.q.x <= ibox.p.x))
         return 2;
     width = (ibox.q.x - ibox.p.x) << log2_scale.x;
+    dev_width = ibox.q.x << log2_scale.x;
     raster = bitmap_raster(width);
     band_space = raster << log2_scale.y;
     height2 = (ibox.q.y - ibox.p.y);
@@ -232,6 +234,7 @@
     if (height > height2)
         height = height2;
     height <<= log2_scale.y;
+    dev_height = ibox.q.y << log2_scale.y;
     mem = pgs->memory;
     mdev = gs_alloc_struct(mem, gx_device_memory, &st_device_memory,
                            "alpha_buffer_init");
@@ -244,13 +247,9 @@
     }
     gs_make_mem_abuf_device(mdev, mem, dev, &log2_scale,
                             alpha_bits, ibox.p.x << log2_scale.x, devn);
-    mdev->width = width;
-    mdev->height = height;
+    mdev->width = dev_width;
+    mdev->height = dev_height;
     mdev->bitmap_memory = mem;
-    /* Set the horrible hacky flag that tells people that the width/height here
-     * have been set for *our* convenience, rather than accurately depicting the
-     * size of the device for callers. */
-    mdev->non_strict_bounds = 1;
     if ((*dev_proc(mdev, open_device)) ((gx_device *) mdev) < 0) {
         /* No room for bits, punt. */
         gs_free_object(mem, mdev, "alpha_buffer_init");

This patch is based on the next commit.
https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=c52b4a80cdfc6d9b7d04f52c4a872717aeeff73c

Are you able to check this patch?

@remkos
Copy link
Contributor Author

remkos commented Jul 19, 2023

@tomio-arisaka : Your patch indeed works to resolve what was seen in GenericMappingTools/gmt#7336 with ghostscript v10.01.0.

I've applied your patch to ghostscript v10.01.2 and that removed the artifacts seen.
Therefore, I've created a new PR #19510

Thanks if you can then approve it.

@remkos remkos changed the title ghostscript: update to 10.0.0 ghostscript: update to 10.01.2 Jul 19, 2023
@remkos remkos changed the title ghostscript: update to 10.01.2 ghostscript: update to 10.01.0 Jul 19, 2023
@remkos remkos mentioned this pull request Jul 19, 2023
12 tasks
@remkos
Copy link
Contributor Author

remkos commented Jul 19, 2023

This PR is now superseded by PR #19510
@tomio-arisaka : Please review that one.

@remkos remkos closed this Jul 19, 2023
@remkos remkos deleted the remkos-gs1000 branch July 19, 2023 21:02
@remkos remkos mentioned this pull request Sep 14, 2023
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants