[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1619-gf531552

[email protected] (Robin Watts)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  f531552c99a04f003412f7a83d4661e927f88d40 (commit)
      from  25f7cb4da347610dd49bd8001746605f1a29caa8 (commit)

----------------------------------------------------------------------
commit f531552c99a04f003412f7a83d4661e927f88d40
Author: Robin Watts <[email protected]>
Date:   Wed Aug 28 12:50:36 2019 +0100

    Bug 701446: Avoid divide by zero in shading.
    
    The previous commit for this bug was enough to solve the problem
    for ppmraw, but not, it seems, for other devices. This addresses
    the division by zero more directly.

diff --git a/base/gxshade6.c b/base/gxshade6.c
index 11fe3cc..41ab5ad 100644
--- a/base/gxshade6.c
+++ b/base/gxshade6.c
@@ -1025,12 +1025,15 @@ gx_shade_trapezoid(patch_fill_state_t *pfs, const gs_fixed_point q[4],
                 re.start.y = ybot;
                 re.end.y   = ytop;
             }
-            /* Now, check whether the left and right edges cross. This can
-             * only happen (for well formed input) in the case where one of
-             * the edges was completely out of range and has now been pulled
-             * in to the edge of the clip region. */
+            /* Now, check whether the left and right edges cross. Previously
+             * this comment said: "This can only happen (for well formed
+             * input) in the case where one of the edges was completely out
+             * of range and has now been pulled in to the edge of the clip
+             * region." I now do not believe this to be true. */
             if (le.start.x > re.start.x) {
                 if (le.start.x == le.end.x) {
+                    if (re.start.x == re.end.x)
+                        return 0;
                     ybot += (fixed)((int64_t)(re.end.y-re.start.y)*
                                     (int64_t)(le.start.x-re.start.x)/
                                     (int64_t)(re.end.x-re.start.x));
@@ -1048,6 +1051,8 @@ gx_shade_trapezoid(patch_fill_state_t *pfs, const gs_fixed_point q[4],
             }
             if (le.end.x > re.end.x) {
                 if (le.start.x == le.end.x) {
+                    if (re.start.x == re.end.x)
+                        return 0;
                     ytop -= (fixed)((int64_t)(re.end.y-re.start.y)*
                                     (int64_t)(le.end.x-re.end.x)/
                                     (int64_t)(re.start.x-re.end.x));


Summary of changes:
 base/gxshade6.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.