[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1967-gf3b0a9e

[email protected] (Robin Watts) Mon, 25 Nov 2019 17:47:10 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  f3b0a9e346a97b23f1f7e016944be514c8b0ec78 (commit)
      from  8a589c19d62884388cb9eff7d12bfba568e667ca (commit)

----------------------------------------------------------------------
commit f3b0a9e346a97b23f1f7e016944be514c8b0ec78
Author: Robin Watts <[email protected]>
Date:   Mon Nov 25 09:44:29 2019 -0800

    Fix indeterminism in gdevatx.c
    
    The compression used by this device relies on compressing pairs of
    bytes; as such we have to be careful that when we offset to the end
    of the line we don't move inot uninitialised data.
    
    We fix this here by blanking an extra byte, and being smarter about
    where we start the search for trailing empties from.
    
    This should resolve the differences we see in the all-devs test.

diff --git a/devices/gdevatx.c b/devices/gdevatx.c
index 08c8ba5..aa5462c 100644
--- a/devices/gdevatx.c
+++ b/devices/gdevatx.c
@@ -179,6 +179,7 @@ atx_print_page(gx_device_printer *pdev, gp_file *f, int max_width_bytes)
     int code = 0;
     byte mask;
     int endidx = width>>3;
+    int rowlen = (width+7)>>3;
 
     /* Enforce a minimum 3" page length. */
     if (page_length_100ths < 300)
@@ -207,8 +208,12 @@ atx_print_page(gx_device_printer *pdev, gp_file *f, int max_width_bytes)
             goto done;
         /* Clear any trailing padding bits */
         row[endidx] &= mask;
+	/* We need an even number of bytes to work with. */
+	end = row + rowlen;
+	if (rowlen & 1)
+	    *end++ = 0;
         /* Find the end of the non-blank data. */
-        for (end = row + raster; end > row && end[-1] == 0 && end[-2] == 0; )
+        while (end > row && end[-1] == 0 && end[-2] == 0)
             end -= 2;
         if (end == row) {		/* blank line */
             ++blank_lines;


Summary of changes:
 devices/gdevatx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)