Package: libtiff-tools
Version: 3.8.2-7

tiff2pdf as supplied by libtiff-tools assumes that tmpfile() will
succeed, and segfaults when trying to deref the NULL FILE * pointer
returned on failure.

This happens on rare occasions when your sysadmin changes /tmp to
root:root 0755 :(

Attached is patch to tiff_3.8.2-7.diff

Cheers,
Jesse
--- tiff_3.8.2-7.diff.orig	2007-04-17 22:50:14.000000000 +0200
+++ tiff_3.8.2-7.diff	2007-04-17 22:58:41.000000000 +0200
@@ -792,6 +792,42 @@
 + 			written += TIFFWriteFile(output, (tdata_t) buffer, 4);
 + 		} else {
 + 			switch (pdfstr[i]){
+--- tiff-3.8.2.orig/debian/patches/tiff2pdf-tmpfile.patch
++++ tiff-3.8.2/debian/patches/tiff2pdf-tmpfile.patch
+@@ -0,0 +1,33 @@
++--- tools/tiff2pdf.c.orig	2007-04-17 22:36:35.000000000 +0200
+++++ tools/tiff2pdf.c	2007-04-17 22:42:34.000000000 +0200
++@@ -444,6 +444,7 @@
++ 	const char *outfilename = NULL;
++ 	tsize_t written=0;
++ 	int c=0;
+++	FILE *tmpostrm = NULL;
++ 	
++ 	t2p = t2p_init();
++ 
++@@ -667,7 +668,11 @@
++ 		}
++ 	} else {
++ #if !defined(_WIN32) || defined(AVOID_WIN32_FILEIO)
++-		output = TIFFFdOpen((int)fileno(tmpfile()), "-", "w");
+++		if ((tmpostrm  = tmpfile()) == NULL) {
+++			output = NULL;
+++		} else {
+++			output = TIFFFdOpen((int)fileno(tmpostrm), "-", "w");
+++		}
++ #else
++ 		{
++ 			TCHAR temppath[MAX_PATH];
++@@ -723,6 +728,9 @@
++ 	if(output != NULL){
++ 		TIFFClose(output);
++ 	}
+++	if (tmpostrm != NULL){
+++		fclose(tmpostrm);
+++	}
++ 	if(t2p != NULL){
++ 		t2p_free(t2p);
++ 	}
 --- tiff-3.8.2.orig/debian/libtiff4-dev.install
 +++ tiff-3.8.2/debian/libtiff4-dev.install
 @@ -0,0 +1,5 @@

Reply via email to