[gs-commits] rev 11852 - in trunk/ghostpdl: pcl pxl xps

henrys at ghostscript.com henrys at ghostscript.com
Mon Oct 25 23:16:07 UTC 2010


Author: henrys
Date: 2010-10-25 23:16:06 +0000 (Mon, 25 Oct 2010)
New Revision: 11852

Modified:
   trunk/ghostpdl/pcl/pctext.c
   trunk/ghostpdl/pcl/pglabel.c
   trunk/ghostpdl/pxl/pxerrors.c
   trunk/ghostpdl/xps/xpsglyphs.c
Log:
Fix crash reported in bug #691717, gs_text_release() should not be
called if gs_text_process() returns an error.


Modified: trunk/ghostpdl/pcl/pctext.c
===================================================================
--- trunk/ghostpdl/pcl/pctext.c	2010-10-25 19:11:15 UTC (rev 11851)
+++ trunk/ghostpdl/pcl/pctext.c	2010-10-25 23:16:06 UTC (rev 11852)
@@ -347,8 +347,9 @@
     code = gs_text_begin(pcs->pgs, &text, pcs->memory, &penum);
     if (code >= 0)
         code = gs_text_process(penum);
+
+    if (code >= 0)
     gs_text_release(penum, "show_char_foreground");
-
     return code;
 }
 
@@ -463,9 +464,9 @@
             gs_pathbbox(pgs, &bbox);
             gs_rectappend(pgs, &bbox, 1);
             gs_eofill(pgs);
-        }
         gs_text_release(penum, "show_char_background");
     }
+    }
 
     pcl_grestore(pcs);
     return code;

Modified: trunk/ghostpdl/pcl/pglabel.c
===================================================================
--- trunk/ghostpdl/pcl/pglabel.c	2010-10-25 19:11:15 UTC (rev 11851)
+++ trunk/ghostpdl/pcl/pglabel.c	2010-10-25 23:16:06 UTC (rev 11852)
@@ -879,8 +879,8 @@
                    "insidedness" - this seems to address the dirty
                    page issue in practice. */
                 pcl_mark_page_for_current_pos(pgls);
+                gs_text_release(penum, "hpgl_print_char");
             }
-	    gs_text_release(penum, "hpgl_print_char");
 	    if ( code < 0 )
 		return code;
 	    gs_setmatrix(pgs, &advance_mat);

Modified: trunk/ghostpdl/pxl/pxerrors.c
===================================================================
--- trunk/ghostpdl/pxl/pxerrors.c	2010-10-25 19:11:15 UTC (rev 11851)
+++ trunk/ghostpdl/pxl/pxerrors.c	2010-10-25 23:16:06 UTC (rev 11852)
@@ -270,10 +270,13 @@
                 code = gs_text_process(penum);
                 if ( code > 0 )
                     code = gs_note_error(errorBadFontData);     /* shouldn't happen! */
+                if ( code >= 0 )
                 gs_text_release(penum, "pxtext");
             }
             gs_scale(pgs, 1 / scale, 1 / scale);
             y += point_size * 8 / 5;
+            if (code < 0)
+                break;
             if ( !*p || !p[1] )
                 break;
         }

Modified: trunk/ghostpdl/xps/xpsglyphs.c
===================================================================
--- trunk/ghostpdl/xps/xpsglyphs.c	2010-10-25 19:11:15 UTC (rev 11851)
+++ trunk/ghostpdl/xps/xpsglyphs.c	2010-10-25 23:16:06 UTC (rev 11852)
@@ -195,11 +195,12 @@
         return gs_throw1(-1, "cannot gs_text_begin() (%d)", code);
 
     code = gs_text_process(textenum);
-    gs_text_release(textenum, "gslt font render");
 
     if (code != 0)
         return gs_throw1(-1, "cannot gs_text_process() (%d)", code);
 
+    gs_text_release(textenum, "gslt font render");
+
     buf->count = 0;
 
     return 0;



More information about the gs-commits mailing list