[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1773-g4fcbece

[email protected] (Robin Watts) Tue, 29 Oct 2019 18:42:30 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  4fcbece468706e0e89ed2856729b2ccacbc112be (commit)
       via  19cebe708b9ee3d9e0f8bcdd79dbc6ef9ddc70d2 (commit)
      from  849e74e5ab450dd581942192da7101e0664fa5af (commit)

----------------------------------------------------------------------
commit 4fcbece468706e0e89ed2856729b2ccacbc112be
Author: Robin Watts <[email protected]>
Date:   Tue Oct 29 17:16:03 2019 +0000

    Avoid some devices dying due to inappropriate resolutions.

diff --git a/contrib/japanese/gdev10v.c b/contrib/japanese/gdev10v.c
index c5f76b4..dc670be 100644
--- a/contrib/japanese/gdev10v.c
+++ b/contrib/japanese/gdev10v.c
@@ -74,7 +74,7 @@ bj10v_open(gx_device * pdev)
     if (pdev->HWResolution[0] < 180 ||
         pdev->HWResolution[1] < 180)
     {
-        emprintf("device requires a resolution of at least 180dpi\n");
+        emprintf(pdev->memory, "device requires a resolution of at least 180dpi\n");
         return_error(gs_error_rangecheck);
     }
     return gdev_prn_open(pdev);
diff --git a/contrib/japanese/gdevalps.c b/contrib/japanese/gdevalps.c
index e6af9cf..31e0fe4 100644
--- a/contrib/japanese/gdevalps.c
+++ b/contrib/japanese/gdevalps.c
@@ -155,13 +155,20 @@ static const char end_md[] = {
 static int
 md_open(gx_device *pdev)
 {
-        static const float md_margins[4] =
-         {	MD_SIDE_MARGIN, MD_BOTTOM_MARGIN,
-                MD_SIDE_MARGIN, MD_TOP_MARGIN
-         };
+    static const float md_margins[4] =
+    {
+        MD_SIDE_MARGIN, MD_BOTTOM_MARGIN,
+        MD_SIDE_MARGIN, MD_TOP_MARGIN
+    };
 
-        gx_device_set_margins(pdev, md_margins, true);
-        return gdev_prn_open(pdev);
+    if (pdev->HWResolution[0] != 600)
+    {
+        emprintf(pdev->memory, "device must have an X resolution of 600dpi\n");
+        return_error(gs_error_rangecheck);
+    }
+
+    gx_device_set_margins(pdev, md_margins, true);
+    return gdev_prn_open(pdev);
 }
 
 /* MD5000 monochrome mode entrance. */

----------------------------------------------------------------------
commit 19cebe708b9ee3d9e0f8bcdd79dbc6ef9ddc70d2
Author: Robin Watts <[email protected]>
Date:   Tue Oct 29 16:01:39 2019 +0000

    Avoid division by zero with bj10v device.
    
    When called with a low resolution, we can end up dividing by zero.
    Spot this in the open call and give a rangecheck error.

diff --git a/contrib/japanese/gdev10v.c b/contrib/japanese/gdev10v.c
index 510a74e..c5f76b4 100644
--- a/contrib/japanese/gdev10v.c
+++ b/contrib/japanese/gdev10v.c
@@ -68,13 +68,26 @@ static dev_proc_print_page(bj10v_print_page);
 static dev_proc_get_initial_matrix(bj10v_get_initial_matrix);
 #endif
 
+static int
+bj10v_open(gx_device * pdev)
+{
+    if (pdev->HWResolution[0] < 180 ||
+        pdev->HWResolution[1] < 180)
+    {
+        emprintf("device requires a resolution of at least 180dpi\n");
+        return_error(gs_error_rangecheck);
+    }
+    return gdev_prn_open(pdev);
+}
+
+
 #if 0
 gx_device_procs prn_bj10v_procs =
   prn_matrix_procs(gdev_prn_open, bj10v_get_initial_matrix,
     gdev_prn_output_page, gdev_prn_close);
 #endif
 gx_device_procs prn_bj10v_procs =
-  prn_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close);
+  prn_procs(bj10v_open, gdev_prn_output_page, gdev_prn_close);
 
 gx_device_printer gs_bj10v_device =
   prn_device(prn_bj10v_procs, "bj10v",


Summary of changes:
 contrib/japanese/gdev10v.c  | 15 ++++++++++++++-
 contrib/japanese/gdevalps.c | 21 ++++++++++++++-------
 2 files changed, 28 insertions(+), 8 deletions(-)