[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1707-g8992f00

[email protected] (Chris Liddell) Thu, 26 Sep 2019 08:48:21 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  8992f00edfd1c39154c013489de2a01d2e9a92ee (commit)
      from  6293a99abfdc73b8881b2090cd7b01a1fbef5370 (commit)

----------------------------------------------------------------------
commit 8992f00edfd1c39154c013489de2a01d2e9a92ee
Author: Chris Liddell <[email protected]>
Date:   Thu Sep 26 09:34:02 2019 +0100

    Bug 701313: Disable libtiff callbacks when libtiff is shared
    
    It seems that libtiff uses global variables to store the error/warning callbacks
    so if two callers in the exe are using the libtiff shared lib, very bad things
    happen (usually a segfault).
    
    So, if that's how we're linked, set the callbacks to NULL.

diff --git a/base/gstiffio.c b/base/gstiffio.c
index e69ad14..a99e5e7 100644
--- a/base/gstiffio.c
+++ b/base/gstiffio.c
@@ -212,10 +212,16 @@ gs_tifsErrorHandlerEx(thandle_t client_data, const char* module, const char* fmt
 
 void tiff_set_handlers (void)
 {
+    /* Bad things happen if multiple callers are using libtiff
+     * with custom error/warning callbacks, so set them to NULL
+     * if we're using a libtiff shared lib
+     */
     (void)TIFFSetErrorHandler(NULL);
     (void)TIFFSetWarningHandler(NULL);
+#if SHARE_LIBTIFF == 0
     (void)TIFFSetErrorHandlerExt(gs_tifsErrorHandlerEx);
     (void)TIFFSetWarningHandlerExt(gs_tifsWarningHandlerEx);
+#endif
 }
 
 #if SHARE_LIBTIFF == 0


Summary of changes:
 base/gstiffio.c | 6 ++++++
 1 file changed, 6 insertions(+)