[gs-code-review] The fix for 11-13, 11-26A, 12-13 and bug 520972

Alex Cherepanov alexcher at quadnet.net
Wed Aug 16 08:59:10 PDT 2006


Reviewers,

This patch partly reverses the change made for the bug 520972
http://cvs.ghostscript.com/cgi-bin/viewcvs.cgi/ghostscript/trunk/gs/src/zupath.c?rev=2453&r1=2241&r2=2453

Ghostscript now throws 'nocurrentpoint' error the same way as Adobe.

I don't understand why the following line is necessary:

     refset_null(next, size);  /*** Why it's needed ? ***/

Without this line a few files (for instance H00216q.pdf) fail with SEGV
in garbage collection.

With this line most crashes clear but a SEGV in mspro.pdf persists.

Regards,
Alex Cherepanov
-------------- next part --------------
Index: gs/src/zupath.c
===================================================================
--- gs/src/zupath.c	(revision 6987)
+++ gs/src/zupath.c	(working copy)
@@ -440,7 +440,7 @@
     int size = (with_ucache ? 6 : 5);
     gs_path_enum penum;
     int op;
-    ref *next;
+    ref *next, upath;
     int code;
 
     /* Compute the size of the user path array. */
@@ -465,12 +465,12 @@
 	    }
 	}
     }
-    code = ialloc_ref_array(rupath, a_all | a_executable, size,
-			    "make_upath");
+    code = ialloc_ref_array(&upath, a_all | a_executable, size, "make_upath");
     if (code < 0)
 	return code;
     /* Construct the path. */
-    next = rupath->value.refs;
+    next = upath.value.refs;
+    refset_null(next, size);  /*** Why it's needed ? ***/
     if (with_ucache) {
         if ((code = name_enter_string(pgs->memory, "ucache", next)) < 0)
 	    return code;
@@ -479,16 +479,8 @@
     } {
 	gs_rect bbox;
 
-	if ((code = gs_upathbbox(pgs, &bbox, true)) < 0) {
-	    /*
-	     * Note: Adobe throws 'nocurrentpoint' error, but the PLRM
-	     * not list this as a possible error from 'upath', so we
-	     * set a reasonable default bbox instead.
-	     */
-	    if (code != e_nocurrentpoint)
-		return code;
-	    bbox.p.x = bbox.p.y = bbox.q.x = bbox.q.y = 0;
-	}
+	if ((code = gs_upathbbox(pgs, &bbox, true)) < 0)
+	    return code;
 	make_real_new(next, bbox.p.x);
 	make_real_new(next + 1, bbox.p.y);
 	make_real_new(next + 2, bbox.q.x);
@@ -543,6 +535,7 @@
 	    ++next;
 	}
     }
+    ref_assign(rupath, &upath);
     return 0;
 }
 


More information about the gs-code-review mailing list