[gs-commits] ghostpdl branch, pdfi, updated. jbig2dec-0.14-2113-gd157d5e

[email protected] (Nancy Durgin)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, pdfi has been updated
       via  d157d5e511d5a73e09c6c9839af9d85f76e19308 (commit)
      from  e7790c9e0ef9e599aebe2ce84e56022dce310602 (commit)

----------------------------------------------------------------------
commit d157d5e511d5a73e09c6c9839af9d85f76e19308
Author: Nancy Durgin <[email protected]>
Date:   Tue Aug 20 15:29:40 2019 -0700

    Hack to disable counting down font in pdfi_grestore().
    
    This is a temporary fix, probably causes memory leaks.
    
    The crash is probably because it leaves a dangling reference in some
    circumstance.  Unfortunately the test sample was too complicated to
    easily pin down the circumstances.   I am not sure what the code here is
    trying to accomplish (Ken?).
    
    Fixes crash on this sample (debugbin/gpdf):
    
    -dPDFDEBUG -Z:vg -sDEVICE=ppmraw -dMaxBitmap=4000m -r300
    ~/work/samples/tests_private/comparefiles/Bug693541.pdf
    
    See also: tests_private/comparefiles/Bug688807.pdf

diff --git a/pdf/pdf_gstate.c b/pdf/pdf_gstate.c
index 140345a..2cde8e8 100644
--- a/pdf/pdf_gstate.c
+++ b/pdf/pdf_gstate.c
@@ -221,8 +221,17 @@ int pdfi_grestore(pdf_context *ctx)
         code = gs_grestore(ctx->pgs);
 
         font1 = pdfi_get_current_pdf_font(ctx);
-        if (font != NULL && (font != font1 || ((pdf_obj *)font)->refcnt > 1))
-            pdfi_countdown(font);
+        if (font != NULL && (font != font1 || ((pdf_obj *)font)->refcnt > 1)) {
+#if REFCNT_DEBUG
+            dbgmprintf2(ctx->memory, "pdfi_grestore() counting down font UID %ld, refcnt %d\n",
+                        font->UID, font->refcnt);
+#endif
+            /* TODO: Disabling this countdown because it causes dangling pointer and segfault in
+             * some cases.  This needs to be addressed properly.
+             */
+            dbgmprintf(ctx->memory, "WARNING pdfi_grestore() DISABLED pdfi_countdown (FIXME!)\n");
+            //pdfi_countdown(font);
+        }
 
         if(code < 0 && ctx->pdfstoponerror)
             return code;


Summary of changes:
 pdf/pdf_gstate.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 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.